Home > Article > Operation and Maintenance > phpstudy switches mysql version
phpstudy switch mysql version
1. Download the new version of mysql
For example, mysql5.7: https://dev.mysql.com/downloads/file/?id=467269
2. Back up phpStudy\PHPTutorial\MySQL
3. Unzip the downloaded new version mysql, place it in phpStudy\PHPTutorial\, and rename it to MySQL
4. Copy a copy of my-default.ini and rename it to my.ini
5. Modify the my.ini configuration
basedir = D:/phpStudy/PHPTutorial/MySQL datadir = D:/phpStudy/PHPTutorial/MySQL/data skip-grant-tables
Note: Change it according to your actual path situation. If you have configuration changes, you can add them yourself if you don’t have them. Just add them under [mysqld]
6. In Enter the MySQL bin directory under cmd (mine is D:/phpStudy/PHPTutorial/MySQL/bin) and execute the initialization command
mysqld --initialize
Note 1: If TIMESTAMP with implicit DEFAULT value is reported. Please use -- explicit_defaults_for_timestamp server option (see documentation for more details). If there is an error, modify the my.ini configuration and add
explicit_defaults_for_timestamp = true
under [mysqld]. Note 2: If 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql is reported modes should be used with strict mode. They will be merged with strict mode in a future release. error, modify my.ini and add it under [mysqld] (direct modification of existing configuration)
sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER
七, Install and start the service
mysqld -install net start MySQL
8. Modify the mysql login password
mysql -uroot -p
PS: No need to enter the password, just press Enter
update mysql.user set authentication_string=password('root') where user='root' and Host ='localhost';
Note: 'root' is just an example , change it to the password you want
Refresh permissions
FLUSH PRIVILEGES;
9. Modify my.ini and comment out skip-grant-tables
# skip-grant-tables
Restartmysql
net stop MySQL net start MySQL
For more phpstudy related technical articles, please visit the phpstudy usage tutorial column to learn!
The above is the detailed content of phpstudy switches mysql version. For more information, please follow other related articles on the PHP Chinese website!