This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
linux:mysql_reset_root_password [2018/06/06 18:03] admin created |
linux:mysql_reset_root_password [2018/06/06 18:09] (current) admin |
||
---|---|---|---|
Line 4: | Line 4: | ||
- Stop mysql service | - Stop mysql service | ||
- | - | + | <code bash> |
+ | systemct stop mysqld | ||
+ | </code> | ||
+ | - add this line to /etc/my.cnf | ||
+ | <code bash> | ||
+ | skip-grant-tables | ||
+ | </code> | ||
+ | - start mysql service | ||
+ | <code bash> | ||
+ | systemct start mysqld | ||
+ | </code> | ||
+ | - Log in like root (whitout password) | ||
+ | <code bash> | ||
+ | mysql -u root | ||
+ | </code> | ||
+ | - change root password | ||
+ | <code bash> | ||
+ | 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 | ||
+ | </code> | ||
+ | |||
+ | - comment line from /etc/mycnf | ||
+ | - restart mysql service | ||
+ | <code bash> | ||
+ | systemct; restart mysqld | ||
+ | </code> | ||
+ |