User Tools

Site Tools


linux:mysql_reset_root_password

MySQL reset root password

  1. Stop mysql service
systemct stop mysqld
  1. add this line to /etc/my.cnf
skip-grant-tables
  1. start mysql service
systemct start mysqld
  1. Log in like root (whitout password)
 mysql -u root
  1. change root password
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
 
Database changed
mysql> update user set authentication_string=password('Isr_1234') where user='root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1
 
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
 
mysql> exit
  1. comment line from /etc/mycnf
  2. restart mysql service
systemct; restart mysqld
linux/mysql_reset_root_password.txt · Last modified: 2018/06/06 18:09 by admin