how to reset mysql or mariadb root password

3
How to reset mysql or Mariadb root password ? 315 Vishnupriya October 14, 2021 General 901 How to reset mysql or Mariadb root password ? 1. First you need to stop mysql or Mariadb server. root@localhost:# service mariadb stop root@localhost: ~ # service mysql stop 2. Start the MySQL/MariaDB server without loading the grant tables. root@localhost: ~# mysqld_safe --skip-grant-tables & When the --skip-grant-tables option is used, anyone can connect to the database server without a password and with all privileges granted. 3. Log in to the Mysql shell root@localhost:~ # mysql -u root.

Upload: others

Post on 18-Dec-2021

14 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: How to reset mysql or Mariadb root password

How to reset mysql or Mariadb root password ?315 Vishnupriya October 14, 2021 General 901

How to reset mysql or Mariadb root password ?

1. First you need to stop mysql or Mariadb server.

root@localhost:# service mariadb stop

root@localhost:~# service mysql stop

2. Start the MySQL/MariaDB server without loading the grant tables.

root@localhost:~# mysqld_safe --skip-grant-tables &

When the --skip-grant-tables option is used, anyone can connect to the database server without apassword and with all privileges granted.

3. Log in to the Mysql shell

root@localhost:~# mysql -u root.

Page 2: How to reset mysql or Mariadb root password

4. Set a new password.

At the mysql > prompt, reset the password. To do this, type the following command,replacing "new-password" with the new root password

UPDATE mysql.user SET Password=PASSWORD('new-password') WHEREUser='root';

5. At the mysql> prompt, type the following commands:

FLUSH PRIVILEGES;

exit;

6. Stop the MySQL server using the following command. You will be prompted to enter thenew MySQL root password before the MySQL server shuts down:

root@localhost:~# mysqladmin -u root -p shutdown

7 Start the mysql/mariadb server normally

root@localhost:~# service mariadb start

Online URL:

Page 3: How to reset mysql or Mariadb root password

https://www.ezeelogin.com/kb/article/how-to-reset-mysql-or-mariadb-root-password-315.html

Powered by TCPDF (www.tcpdf.org)