Home > Database > Mysql Tutorial > body text

How to Disable Password Protection for the MySQL Root User?

Susan Sarandon
Release: 2024-11-01 03:04:27
Original
586 people have browsed it

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;
    Copy after login
  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';
    Copy after login

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
Copy after login

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!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!