mysql installation and log in problem solving

# 1. Stop mysql database

/etc/init.d/mysqld stop

2. Run the following command

mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

3. Log in as root mysql database

mysql -u root mysql

4. Update the root password

mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';

The latest version of MySQL, please use the following SQL:

mysql> UPDATE user SET authentication_string=PASSWORD('newpassword') where USER='root';

5. Refresh rights

mysql> FLUSH PRIVILEGES;

6. Exit mysql

mysql> quit

7. Restart mysql

/etc/init.d/mysqld restart

8. Use the root user to log back mysql

-p-uroot-MySQL
the Enter password: <enter the new password of newpassword>

Guess you like

Origin www.cnblogs.com/zhidaCoding/p/11289201.html
Recommended