设置mysql 的root密码

来源:互联网 发布:软件质量目标 编辑:程序博客网 时间:2024/03/28 23:28

我们都知道通常连接mysql都是通过root用户名和密码连接,默认情况下在Mysql安装时root初始密码为空,在安装使用框架时,都需要填写连接Mysql的用户名和密码。先输入mysql进入数据库:

>update mysql.user set password=password('新密码') where User="root" and Host="localhost";

>flush privileges;


有可能会报一个错,column('password') 不存在,这时候,你需要将password更改为authentication_string

>update mysql.user set authentication_string=password('新密码') where User="root" and Host="localhost";

>flush privileges;


这样就OK了。。

> quit

退出mysql。

命令行再次输入mysql,发现已经进不去了。你需要这样

mysql -u root -p

:输入密码

好了。你已经设好密码了

1 0
原创粉丝点击