Home >Database >Mysql Tutorial >A common pitfall in Mysql development - Unable to start Mysql
I was in a hurry yesterday and accidentally deleted the Mysql
built-in database. As a result, I used Navicat
to open it the next day. Various errors were reported, but it took me 2 hours to solve various bugs. I will record the following here so that I can accidentally make the same mistake again in the future.
Due to various errors reported, today I ruthlessly deleted all MySql
and Navicat
, and reinstalled them. After the installation was completed , if you want to enter mysql
under CMD
to be effective, you need to configure the MySql environment variable under the system. My system is Win10. The configuration is as shown below
(1) Right click on the computer--Properties--Advanced system settings--Environment variables--Path
(2) Environment variables--System variables Path--New environment variable --This section fills in the bin path under the Mysql installation path
After configuration, use CMD to net start mysql
Start MySql or computer management-service-- After defining MySql startup, I had no choice but to start reporting the first error
I searched for various solutions on the Internet and got a useful method. I found it in the MySql installation directorymy.ini
file, modify default-storage-engine=INNODB
to default-storage-engine=MYISAM
, restart to open MySql
Enter net start mysql under CMD and prompt system error 5. This problem is caused by not logging in as an administrator. Yes, right-click CMD to run as administrator (right-clicking on the program has no effect, you can navigate to C:\windows\System32\CMD
and then right-click to run as administrator) Run
I thought MySql was started and Navicat could be used to connect to the database, but another error was reported. This error was solved It is relatively complicated, the steps are as follows:
(1) Stop the MySql service cmd:net stop mysql
(2) Open my. ini
Find [mysqld]
and then add skip_grant_tables
--meaning to start MySQL Skip permission table authentication when serving
(3) Start Mysql, enter mysql under cmd to see the welcome message in English, and then enter the following use mysql
connection permissions Database
(4)Change passwordupdate user set password=password("123456") where user="root";
(5)Refresh permissions flush privileges
(6) Finally exit quit
(7) Add the in step 2 skip_grant_tables
Remove it and restart MySql, it will be successful
Related recommendations:
MySQL service is starting.MySQL service cannot start up. System error
Old boy mysql video tutorial:MySQL database multiple instances Startup problem troubleshooting methods and practical troubleshooting
The above is the detailed content of A common pitfall in Mysql development - Unable to start Mysql. For more information, please follow other related articles on the PHP Chinese website!