码迷,mamicode.com
首页 > 数据库 > 详细

mysql安装以后无法登陆的的解决方法((ERROR 1698 (28000): Access denied for user 'root'@'localhost'))

时间:2018-07-21 14:44:00      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:完成   listen   print   rem   xargs   pkg   ges   native   art   

  1. mysql安装以后无法登陆的的解决方法((ERROR 1698 (28000): Access denied for user ‘root‘@‘localhost‘))

     

    解决步骤:

    [====>>https://www.cnblogs.com/leolztang/p/5094930.html
    1.sudo mysql -u root -p
    2.select user, plugin from mysql.user;
    3.update mysql.user set authentication_string=PASSWORD(newPwd), plugin=mysql_native_password where user=root;
    4.flush privileges;
    5.exit

     


    6.重启进入


    1. 删除mysql

    a. sudo apt-get autoremove --purge mysql-server-5.0
    b. sudo apt-get remove mysql-server
    c. sudo apt-get autoremove mysql-server
    d. sudo apt-get remove mysql-common (非常重要)

     


    上面的其实有一些是多余的,建议还是按照顺序执行一遍

    2. 清理残留数据

    dpkg -l |grep ^rc|awk {print $2} |sudo xargs dpkg -P

     



    3. 安装 mysql

    a. sudo apt-get install mysql-server
    b. sudo apt-get install mysql-client
    c. sudo apt-get install php5-mysql(安装php5-mysql是将php和mysql连接起来 )

     



    一旦安装完成,MySQL服务器应该自动启动。您可以在终端提示符后运行以下命令来检查 MySQL 服务器是否正在运行:

    4. 检查Mysql是否正在运行

    sudo netstat -tap | grep mysql

     


    当您运行该命令时,您可以看到类似下面的行:

    root@ubuntu:~# sudo netstat -tap | grep mysql
    tcp 0 0 localhost.localdo:mysql *:* LISTEN 
    870/mysqld

     


    如果服务器不能正常运行,您可以通过下列命令启动它:

    sudo /etc/init.d/mysql restart

     

    打开mysql:

    sudo mysql

     

    本文主要摘自:https://blog.csdn.net/wsywb111/article/details/78901889






mysql安装以后无法登陆的的解决方法((ERROR 1698 (28000): Access denied for user 'root'@'localhost'))

标签:完成   listen   print   rem   xargs   pkg   ges   native   art   

原文地址:https://www.cnblogs.com/fwl8888/p/9346229.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!