在 ubuntu 12.04 中连接到 mysql 服务器时出错 [英] Error connect to mysql server in ubuntu 12.04
问题描述
我正在尝试从终端连接到 ubuntu 12.04 中的 mysql 服务器使用和密码为空("")
I am trying to connect to mysql server in ubuntu 12.04 from terminal using and password empty("")
mysql -u root -p
它抛出错误
ERROR 2002 (HY000): Can't connect to mysql server through socket 'var/run/mysql/mysqld.sock'(2)
虽然我能够从 phpmyadmin 成功访问数据库,但我看到在 mysql 数据库的用户用户表中没有 root 的密码.
Though i am able to access database successfully from phpmyadmin and there i see there is no password for root in user user table in mysql database.
我正在使用 xampp 包
I am using xampp package
推荐答案
我认为错误是套接字文件.你在哪里安装你的 xampp?
I think the error is the socket file. Where did you install your xampp?
你可以试试吗,
mysql -u root -p --socket=/opt/xampp/var/mysql/mysql.sock
mysql -u root -p --socket=/opt/xampp/var/mysql/mysql.sock
其中 opt 是您的安装目录.将 opt 更改为您的安装目录.
where opt is your installation directory. Change opt to your installation directory.
或者如果你不想在你的 mysql 命令中使用 socket 参数,你可以尝试
edit: Or if you don't want using socket parameter on your mysql command, you can try
ln -s/opt/xampp/var/mysql/mysql.sock/var/run/mysql/mysqld.sock
ln -s /opt/xampp/var/mysql/mysql.sock /var/run/mysql/mysqld.sock
谢谢.
这篇关于在 ubuntu 12.04 中连接到 mysql 服务器时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!