Q: How do I remove the password for the root user in MySQL via the command line interface?
A: To set the root user's password to null (i.e., no password), follow these steps in the MySQL command line client:
<code class="sql">use mysql; update user set authentication_string=password(''), plugin='mysql_native_password' where user='root';</code>
In case the 'plugin' field is set to 'auth_socket,' you may also need to change it along with the password:
<code class="sql">use mysql; update user set authentication_string=password(''), plugin='mysql_native_password' where user='root';</code>
Once these updates are complete, you will be able to connect as the root user without providing a password by simply running the command:
<code class="sql">mysql -u root</code>
The above is the detailed content of How to Remove the Password for the Root User in MySQL?. For more information, please follow other related articles on the PHP Chinese website!