我需要重置本地mysql安装的root密码,但不会让我。我已经试过了:
$ sudo /etc/init.d/mysql stop
* Stopping MySQL database server mysqld [ OK ]
[1]- Exit 1 sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking
[2]+ Exit 1 sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking
reg@regDesktopHome:~$ sudo mysqld --skip-grant-tables &
[1] 13651
reg@regDesktopHome:~$ 140627 19:02:02 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
reg@regDesktopHome:~$ mysql -u root mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
reg@regDesktopHome:~$ sudo mysql -u root mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[1]+ Exit 1 sudo mysqld --skip-grant-tables
如何重置密码? 编辑1 我得到了这个:
$ ps ax| grep mysql
16515 ? Ssl 0:00 /usr/sbin/mysqld
16551 pts/23 S+ 0:00 grep --color=auto mysql
reg@regDesktopHome:~/semios/v3upgrade$ sudo kill -9 16515
reg@regDesktopHome:~/semios/v3upgrade$ ps ax| grep mysql
16678 ? Ssl 0:00 /usr/sbin/mysqld
16715 pts/23 S+ 0:00 grep --color=auto mysql
reg@regDesktopHome:~/semios/v3upgrade$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
看起来进程一杀死我就会自动重启mysql ...
dpkg-reconfigure mariadb-server-10.1
当所有其他解决方案均未解决时,可以确认该方法对MariaDB有效。这次真是万分感谢。