Step 1. 检查默认账户和密码

$cat /etc/mysql/debian.cnf  # 在ubuntu下查看默认账户名和密码

会看到

[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

Step 2. 使用默认账户登录并修改root密码

$mysql -u debian-sys-maint -p
Enter password:
mysql> use mysql;
mysql> update user set authentication_string=PASSWORD('密码') and plugin='mysql_native_password' where User='root'; # 注意此处PASSWORD() 函数不可少
mysql> flush privileges;
mysql> exit;
$ sudo service mysql restart  # 重启mysql服务

Step 3. 使用root登录

$ mysql -u root -p
Enter password: mysql>

最新文章

  1. C语言--乱写C语言
  2. mysql存储过程中 乱码问题解决办法
  3. oracle在cmd中启动数据库实例
  4. csuoj 1116: Kingdoms
  5. ps -C
  6. jmeter 建立一个网络服务的测试计划
  7. (09)odoo工作流
  8. hadoop2.2.0 MapReduce求和并排序
  9. Windbg找出死锁
  10. 添加一个Application Framework Service
  11. 百度短信API开发
  12. 每日一练ACM
  13. springMVC4(7)模型视图方法源代码综合分析
  14. (zhuan) 资源|TensorFlow初学者必须了解的55个经典案例
  15. 【C#】 基于ArcFace 2.0—视频人脸识别Demo
  16. 查看ubuntu版本号
  17. 基于jCOM搭建Java-微软信息桥梁(下)
  18. xshell sftp可用命令,sftp: cannot open d: to write![解决]
  19. HDU 2138 Miller-Rabin 模板题
  20. linux initcall 介绍 (转自http://blog.csdn.net/fenzhikeji/article/details/6860143)

热门文章

  1. 【翻译】--19C Oracle 安装指导
  2. Computer Vision_18_Image Stitching:Automatic Panoramic Image Stitching using Invariant Features——2007
  3. word生成目录的pdf
  4. Linux 02 Linux基本概念及操作
  5. Ubuntu系统---系统驱动丢失、Kernel内核卸载、禁止更新
  6. 成功解决 AttributeError: module 'tensorflow.python.keras.backend' has no attribute 'get_graph'
  7. [HNOI2007]分裂游戏 SG打表博弈
  8. 如何用pycharm 控制远程服务器来跑代码!!!!!!!!!!!!非常牛逼
  9. express框架初步
  10. 洛谷P2114 起床困难综合症【位运算】【贪心】