Home  >  Article  >  Database  >  How to Disable Password Protection for the MySQL Root User?

How to Disable Password Protection for the MySQL Root User?

Susan Sarandon
Susan SarandonOriginal
2024-11-01 03:04:27587browse

How to Disable Password Protection for the MySQL Root User?

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:

  1. Switch to the mysql database:

    use mysql;
  2. 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn