无法连接到mysql服务器数据库

时间:2016-12-09 13:38:14

标签: mysql

问题

我无法连接到MYSQL服务器数据库

这就是我所做的。

我安装了MYSQL Server 5.7.16,并获得了一个临时密码。enter image description here

我去了

/usr/local/mysql/bin 

enter image description here

我输入了sudo ./mysql -u root -p并提示输入密码,我输入了MYSQL安装期间给出的临时密码(st * rukZV * 5k<)并收到错误

"Access denied for user 'root'@'localhost' (using password: YES) "

enter image description here

我甚至在没有密码的情况下尝试它只是在提示输入密码时按Enter键我收到错误

"Access denied for user 'root'@'localhost' (using password: NO).

enter image description here

我甚至尝试通过运行以下命令来启动mysqld,它说服务已经加载。

sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist

enter image description here

请帮助。

1 个答案:

答案 0 :(得分:0)

我通过以下步骤解决了这个问题。

  1. 输入此命令停止mysqld

    sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist]
    

    enter image description here

  2. 2.卸载mysql服务器

    sudo rm -rf mysql*
    

    enter image description here

    3.reinstall mysql server(重新安装后发出的新临时密码)

    enter image description here

    1. 输入命令

      sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
      
    2. 转到/ usr / local / mysql / bin

    3. enter image description here

      1. 输入命令./mysql -u root -h localhost -p后跟新的临时密码
      2. enter image description here

相关问题