Resetting the MySQL root (Root) password under Linux (CentOS), and solving the problem of limited IP connection for remote login to mysql

1. Reset MySQL root (Root) password under Linux (CentOS) (Reference: http://www.jb51.net/article/108700.htm )

1. "service mysqld status" to view the current mysql service status

2. The "killall -TERM mysqld" command stops all mysqld processes.

3. The "service mysqld stop" command stops the mysqld service.

4. The "mysqld_safe --skip-grant-tables &" command enters MySQL safe mode without a password.

5. "mysql -u root" and press Enter.

6. "use mysql;" to mount the database.

7. "update user set password=password("New9ssw0rd") where user='root';" Change the Root password to New9ssw0rd.

8. "flush privileges;" update privileges.

9. "quit" and press Enter to exit.

10. "service mysqld restart" restarts the mysqld service.

11. "mysql -u root -p" and press Enter to prompt for a password.

2. Solve the problem of limited IP connection for remote login to mysql

1、use mysql;

2、select host,user,password from user;

3. GRANT ALL ON *.* TO root@' authorized IP ' IDENTIFIED BY ' your password ';

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325812997&siteId=291194637