当前位置 博文首页 > 韦全敏的博客:解决ubuntu系统安装mysql不能修改root密码问题
最近在搭建一个docker的环境,安装了mysql-server之后没有出现在网上别的教程中出现的设置密码的界面,比如这个(我的根本就没有这种设置好吗?)。
说道解决办法应该有两种,先说说第一种:
mysql_secure_installation
进入安全设置向导,可以配置root密码,移除测试数据库等等。service mysql status
查看运行状态service mysql start
启动mysql/etc/mysql/debian.cnf
中有一个名字叫做debian-sys-maint
,密码是随机的。mysql -u debian-sys-maint -p
登录use mysql
)update mysql.user set authentication_string=password('password') where user='root'and Host = 'localhost';
root的密码就被设置为password
了authentication_string
字段可以尝试password
字段。出现类似情况的同学可以试试这两个方法,共勉。
cs