Then, update the root password, the SQL is as follows: mysql> update user set authentication_string=password('root') where Host='localhost' and User='root' ġ In some versions of mysql, the password may be stored in the password field. You can turn off this feature to get a quicker startup with -A See the result: Reading table information for completion of table and column names Open the 'mysql' database, the SQL is as follows: mysql> use mysql Type '\c' to clear the current input statement. Other names may be trademarks of their respective Oracle is a registered trademark of Oracle Corporation and/or itsĪffiliates. Server version: 5.7.13 MySQL Community Server (GPL)Ĭopyright (c) 2000, 2016, Oracle and/or its affiliates. The third step: Do not close the current terminal window, create a new terminal window, enter the following command, enter mysql login /usr/local/mysql/bin/mysqlĪfter logging in, see the welcome message: Welcome to the MySQL monitor. T08:29:17.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data The results are as follows: T08:29:17.6NZ mysqld_safe Logging to '/usr/local/mysql/data/'. The command is as follows: sudo /usr/local/mysql/bin/mysqld_safe -skip-grant-tables Step 2: Start mysqld_safe with administrator privileges in the terminal. Step 1: If the mysql service is in progress, stop it.