How to Remove the Root Password from MySQL
Setting the MySQL root user password to null effectively disables password protection. To do this from the MySQL command line client, follow these steps:
Switch to the mysql database:
use mysql;
Update the user table to set the authentication string to null and change the plugin to mysql_native_password:
update user set authentication_string=password(''), plugin='mysql_native_password' where user='root';
In some cases, you may need to change the plugin field if it is set to a different value, such as auth_socket.
After completing these steps, you will be able to connect to MySQL as the root user without a password:
mysql -u root
The above is the detailed content of How to Disable Password Protection for the MySQL Root User?. For more information, please follow other related articles on the PHP Chinese website!