下载Mysql
下载地址: https://dev.mysql.com/downloads/mysql/
下载文件: zip压缩包(mysql-8.0.28-winx64.zip)
。
无需登录,点击底部“No thanks, just start my download.” 即可开始下载
解压文件到不包含空格的目录下
配置初始化的my.ini文件
[client]
default-character-set = utf8mb4
[mysqld]
port = 3306
basedir = D:\\App\\mysql-8.0.28-winx64
# datadir=D:\\Users\\admin\\dnmp\\data\\mysql
max_connections=2000
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
default-storage-engine=INNODB
default-time-zone = '+8:00'
[mysql]
default-character-set = utf8mb4
安装和启动
# 创建数据库目录并生成临时密码
mysqld --initialize --console
# 安装到系统服务中。此步骤必须以管理员身份运行。
mysqld --install
# 开启服务
net start mysql
# 停止服务
net stop mysql
问题解答
如果是mysql8较新版本,使用第三方客户端连接。可能报错:
Public Key Retrieval is not allowed Public Key Retrieva
如过是Dbeaver客户端,可设置连接地址为:jdbc:mysql://127.0.0.1:3306/?allowPublicKeyRetrieval=true&useSSL=false
如果报错:
Your password has expired. To log in you must change it using a client that supports expired passwod
则要使用mysql的bin目录下。输入命令:mysql -u root -p
然后输入密码。接着改密码。
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
alter user 'root'@'localhost'password expire never;
# Too many connections.
mysql> show variables like '%max_connections%';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| max_connections | 2000 |
| mysqlx_max_connections | 100 |
+------------------------+-------+
2 rows in set (0.01 sec)
# Lock wait timeout exceeded; try restarting transaction
mysql> show variables like 'innodb_lock_wait_timeout';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| innodb_lock_wait_timeout | 50 |
+--------------------------+-------+
1 row in set (0.02 sec)
https://blog.csdn.net/w10101010_y/article/details/83388965