我从“ Ubuntu软件中心”在Ubuntu 16.04.1上安装了MySql Server和MySql Client。
据我所知,当您mysql-server
从终端安装时,它会root
在安装过程中提示输入密码。但是,当我从“ Ubuntu软件中心”安装它时,它只是安装了,我不知道root
密码是什么。
如果正在运行,以下是停止/杀死现有mysql守护程序的方法:
sudo ps -ef | grep mysql - checks if mysql/mysqld is one of the running processes.
sudo kill -9 'pid' mysqld - kills the daemon, if it is running.
跳过授予表来运行MySQL安全守护程序
sudo mysqld_safe --skip-grant-tables &
以root用户身份登录MySQL,无需密码
sudo mysql -u root mysql
运行UPDATE查询以重置root密码
UPDATE user SET authentication_string=PASSWORD("MyNewPassword") WHERE user="root";
FLUSH PRIVILEGES;
停止MySQL安全守护程序
sudo ps -ef | grep mysqld_safe
sudo kill -9 'pid' mysqld_safe
启动MySQL守护程序
sudo /etc/init.d/mysql start
特权已清除。启动MySQL并以root用户身份使用您重置的密码登录
sudo mysql -u root -p mysql
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句