In this method, you stop the server and start it by specifying --skip-grant-tables, which will not load the grant tables. You can connect to the server as root without a password and set the password. Since the server runs without grants, it is possible for users from other networks to connect to the server. So as of MySQL 8.0.3, --skip-grant-tables automatically enables --skip-networking, which does not allow remote connections:
- Stop the server:
shell> sudo systemctl stop mysqldshell> ps aux | grep mysqld | grep -v grep
- Start the server with the --skip-grant-tables option:
shell> sudo -u mysql /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid --user=mysql --skip-grant-tablesmysqld will log errors ...