时间:2021-07-01 10:21:17 帮助过:18人阅读
- <code>$cat /etc/mysql/debian.cnf # 在ubuntu下查看默认账户名和密码</code>
会看到
- <code>[client]
- host = localhost
- user = debian-sys-maint
- password = ****************
- socket = /var/run/mysqld/mysqld.sock
- [mysql_upgrade]
- host = localhost
- user = debian-sys-maint
- password = ****************
- socket = /var/run/mysqld/mysqld.sock</code>
- <code>$mysql -u debian-sys-maint -p
- Enter password:</code>
- <code>mysql> use mysql;
- mysql> update user set authentication_string=PASSWORD('密码') and plugin='mysql_native_password' where User='root'; # 注意此处PASSWORD() 函数不可少
- mysql> flush privileges;
- mysql> exit;</code>
- <code>$ sudo service mysql restart # 重启mysql服务</code>
- <code>$ mysql -u root -p
- Enter password:
- mysql></code>
安装mysql后必须要做的一件事
标签:sock native rest service res ubunt word 修改 upgrade