Home > Database > Mysql Tutorial > body text

How to modify the MySQL root account under mac

PHPz
Release: 2023-04-20 10:33:39
Original
794 people have browsed it

Under the Mac operating system, if you need to modify the MySQL root account, you can follow the steps below.

Step 1: Stop the MySQL service
Open the terminal and enter the following command to stop the MySQL service:
sudo /usr/local/mysql/support-files/mysql.server stop

Step 2: Restart the MySQL service and skip permission authentication
Enter the following command to restart the MySQL service and skip permission authentication:
sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables

Note: If the "command not found" error occurs, please confirm whether the MySQL installation path is /usr/local/mysql.

Step 3: Log in to MySQL as root
Open another terminal window and enter the following command to log in to MySQL as root:
mysql -u root

Tip: If "Permission denied" error, please check whether you have successfully skipped permission authentication.

Step 4: Modify the root account password
After logging in to MySQL, enter the following command to modify the root account password:
mysql>use mysql;
mysql>update user set password=password(' newpassword') where user='root';
mysql>flush privileges;

Among them, "newpassword" is the new password you need to set.

Step 5: Restart the MySQL service
Enter the following command to restart the MySQL service:
sudo /usr/local/mysql/support-files/mysql.server start

Congratulations, you have now successfully changed the MySQL root account password. Through the above steps, you can easily modify the MySQL root account under the Mac operating system.

The above is the detailed content of How to modify the MySQL root account under mac. 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
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!