在开启mysql服务的适时候,使用--skip-grant-tables 参数跳过权限检查启动mysql
[root@potato Desktop]# mysqld_safe --skip-grant-tables
161209 00:01:29 mysqld_safe Logging to '/data/mysql/mytest_3306/data/error.log'.
161209 00:01:29 mysqld_safe Starting mysqld daemon with databases from /data/mysql/mytest_3306/data
mysql> USE mysql ;
mysql>
UPDATE
user
SET
Password
=
password
(
'new-password'
)
WHERE
User
=
'root'
;
mysql> flush
privileges
;
mysql> quit
|