The root password of mysql on mac is forgotten or the permission is incorrect. In the past few days, mantis found that the connection to mysql is always wrong, and the root permission is changed, causing login failure. The following are the most convenient methods to restore root permissions and change the root password. 1: Install mysql workbench. Directly operate on the visual interface. 2: Apple-> system preference settings-> at the bottom of the page, click mysql to close the mysql service on the pop-up page. 3. Enter the terminal: cd/usr/local/mysql/bin/press enter and then log on to the Administrator permission sudo su press enter and enter the following command to disable mysql verification. /mysqld_safe -- skip-grant-tables & press enter to restart mysql automatically. After restart, enter mysql workbench to create a connection and enter root as the username (note that the password will not be verified here, therefore, you only need to enter an existing account ). Create a server administration and select the connection you just created. Double-click server administration and click security on the left side. All user permission tables are displayed on the right side. You can do whatever you want. The following are some instructions: in the user permission table, Limit Connectivity to Hosts Matching indicates the logon address Limit, that is, the IP address used for Logon. '%' indicates that any Adminstrative Roles is the permission. If you find that your root account has no administrator permission, click this tab and select all other commands. /mysqladmin-u root-p password 123 // change the root user password. /mysql-uroot-p // the following common ERROR occurs when the root user logs on to mysql: ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: YES) if your root permission is insufficient, you can refer to the above steps. Set the permission to Access denied; you need (at least one of) the SUPER privilege (s) for this operation indicates that your root permission is insufficient, you can refer to the above steps to set permissions so far my database has finally been retrieved ~~