“Failed to start MySQL server”


No matter how many times you have installed mysql, there are still all kinds of errors. Now that they appear, try to solve them: OK!

Next, I will teach you how to check the error log to solve the code errors.



After some column restart operations and checking the error details, we can’t accurately find the cause of the error. After a lot of Baidu, we found that some said that the disk space was insufficient, and some said that var / lib / MySQL needed to be deleted

Either way, we should find a solution to our own problems.

I have enough disk space, so I tried to delete var / lib / MySQL

When I execute service MySQL restart again, I still report an error.


 Next, we need to make a big move. Check the system log, as shown in the figure below, and find that we need to reinitialize mysql


Execute the following command, and then restart to achieve the goal! Kaisen


ha-ha!!! There is no gorgeous language, I hope you can understand it…


Here, if you install MySQL server version 5.7 or above on Ubuntu, the initial password may not be set during installation. Execute the following command to log in

Sudo MySQL - U root - P carriage return

If you don't have a password, just press enter


Modify the login password here

Method 1: use the set password command 
First, log in to MySQL. 
Format: MySQL > set password for user name @ localhost = password ('New password '); 
Example: MySQL > set password for [email protected]  = password('123'); 

Method 2: using mysqladmin 
Format: mysqladmin - U user name - P old password new password 
Example: mysqladmin - uroot - p123456 password 123 

Method 3: edit user table directly with update 
First, log in to MySQL. 
mysql> use mysql; 
mysql> update user set authentication_string=password('123') where user='root' and host='localhost'; 
mysql> flush privileges; 

Method 4: when you forget the root password, you can do this 
Take windows as an example 
1. Close the running MySQL service. 
2. Open the DOS window and go to the directory MySQL / bin. 
3. Enter mysqld -- skip grant tables and enter. --Skip grant tables means to skip permission table authentication when starting MySQL service. 
4. Open another DOS window (because the DOS window just now can't move), and go to the MySQL / bin directory. 
5. Enter MySQL carriage return, if successful, MySQL prompt > will appear. 
6. Connect to permission database: use MySQL. 
6. Change the password: update user set password = password ("123") where user = "root"; (don't forget to add a semicolon at the end). 
7. Refresh permissions (required steps): flush privileges. 
8. Quit quit. 
9. Log out of the system, and then log in with the user name root and the new password 123 you just set.


Recommended Today

Review of SQL Sever basic command

catalogue preface Installation of virtual machine Commands and operations Basic command syntax Case sensitive SQL keyword and function name Column and Index Names alias Too long to see? Space Database connection Connection of SSMS Connection of command line Database operation establish delete constraint integrity constraint Common constraints NOT NULL UNIQUE PRIMARY KEY FOREIGN KEY DEFAULT […]