MySQL 5.7. 18 installation tutorial under Windows
- 2021-08-28 21:22:47
- OfStack
This article explains installing MySQL from a compressed package.
1. Download the MySQL compressed package, "Windows (x86, 64-bit), ZIP Archive";
2. Extract the Zip package to the desired directory, such as D:\ mysql-5. 7.18-winx64;
3. Create the my. ini file as follows:
[mysqld]
port=3306
basedir=D:\\mysql-5.7.18-winx64\\
datadir=F:\\mysqlData\\
character-set-server=utf8
Note that basedir and datadir must be configured, and basedir is the directory you unzipped. According to the official document, if you like to use slashes, you should use double slashes, but not backslashes. That is: D:\\ mysql-5. 7.13-winx64\\ or: D:/mysql-5. 7.13-winx64/
Because I like the database data files independent, so the datadir configuration to other places, convenient management.
4. Configure environment variables
Add a variable named MYSQL_HOME.
Modify the Path variable to add% MYSQL_HOME%\ bin at the end
5. Initialize and start the Mysql service
Run cmd with administrator privileges, initialize MySQL, and execute
mysqld --initialize-insecure
Register the MySQL service, start MySQL, and execute
mysqld -install
net start mysql
6. Log in to MySQL and set root password
mysql -uroot -p
When logging in for the first time, enter the car directly without password. After logging in to mysql, set the root password
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
After changing the password, we can log in successfully using root.