O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using --skip-grant-tables

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:

  1. Stop the server:
shell> sudo systemctl stop mysqldshell> ps aux | grep mysqld | grep -v grep
  1. 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required