Series Article Directory
Article directory
- Series Article Directory
- foreword
- 1. Go to the official website to download the zip installation package
- Two, configuration
- Create my.ini file
- 3. Open the dos command window as an administrator
- 4. Install mysql8 service and initialize data
- 5. Start
- 6 Error resolution: Modify the registry of the mysql8 service
- at last
foreword
Version 5.7 was installed before and version 8.0 was installed due to need
1. Go to the official website to download the zip installation package
After the download is complete, unzip to the location you want to install.
For example, D:\go\mysql-8.0.32-winx64 is directly decompressed to the D drive like this.
Two, configuration
Create my.ini file
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
#设置3307端口
port = 3307
# 设置mysql的安装目录
basedir=D:\mysql-8.0.24-winx64
# 设置mysql数据库的数据的存放目录
datadir=D:\mysql-8.0.24-winx64\data
# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
port=3307
default-storage-engine=INNODB
2. Environment variables
3. Open the dos command window as an administrator
cd to switch to the bin directory of mysql8
4. Install mysql8 service and initialize data
Then enter this command to initialize it:
mysqld --initialize --console
There is a temporary password in the output here, which will be used when logging in to mysql 8 later. like this
[Note] [MY-010454] [Server] A temporary password is generated for root@localhost: XIfdsff,fY7,?
Among them, XIfdsff,fY7,?
this is the temporary password.
Then, enter the command to install the mysql service (mysql8 is a custom service name, just take whatever you like):
mysqld --install mysql8
The output of Service successfully installed means that the installation is successful.
5. Start
Then enter the command to start the mysql8 service in dos:
net start mysql8
Of course, since the installation of version 5 is not successful at the beginning, you need to stop the startup service of version 5 and
enter win+r after runningServices.msc
The temporary password just now is definitely not easy to use. Change the password and enter the command to enter mysql8:
mysql -u root -P3307 -p (刚才的临时密码)
At this time, an error may be reported, which is related to
Can‘t connect to MySQL server on ‘localhost:3307‘ (10061)
This error
Note: When logging in to mysql8, you must add -P3307. If you don’t add it, you will log in to mysql5 using port 3306. Use whatever port you just set, not necessarily 3307.
6 Error resolution: Modify the registry of the mysql8 service
Use the shortcut key win+r to open the running window, enter regedit and press Enter to open the registry, log in, and
modify the path. The previous path is the installation directory of version 5, so you need to change it to version 8.
At this time, mysql -u root -p -P3307
just output the above initial password and it will not There will be an error.
The modification method:
set password for root@localhost = password('root');
password('root') 里的 root 就是设置的新密码。
ALTER USER 'root'@'localhost' IDENTIFIED WITH MYSQL_NATIVE_PASSWORD BY 'root';
The root in BY 'root' is the new password set.
at last
It can be checked in Navicat or viewed through idea. When configuring Idea, add the value of serverTimeZone in Advanced.Asia/Shanghai