zoukankan      html  css  js  c++  java
  • 腾讯云ubuntu16.04安装MySql5.7未提示密码设置且无法登陆解决

    一、安装

    sudo apt-get update
    sudo apt install mysql-server

    二、修改密码

    1、由于安装过程中未提示要设置密码,且使用sudo mysql_secure_installation命令过程一直报错:Error: Access denied for user 'root'@'localhost' (using password: YES)

    解决方法:

    1、进入到etc/mysql目录下,查看debian.cnf文件:

    sudo cat debian.cnf

     

    2、查看到MySql的用户名、密码,并登录:

    用户名: debian-sys-maint
    密码:bgZ3yhfFiou0mfGY

    登录: mysql -udebian-sys-maint -pbgZ3yhfFiou0mfGY

     

    3、修改用户名和密码

    show databases;

    use mysql;

    update user set authentication_string=PASSWORD("你自己的密码") where user='root';

    update user set plugin="mysql_native_password";

    flush privileges;

    quit;

    4、重启MySql

    /etc/init.d/mysql restart

    5、正常登录

  • 相关阅读:
    Python3入门基础--str常用方法
    大学jsp实验4include,forword
    大学jsp实验3include指令的使用
    初识MFC----运行时类信息机制
    状态栏
    工具栏
    菜单栏
    程序启动画面
    字符串的截取
    字符串相关类
  • 原文地址:https://www.cnblogs.com/darklights/p/11595344.html
Copyright © 2011-2022 走看看