更改目录

时间:2016-03-16 00:32:48

标签: php mysql raspberry-pi

我正在尝试连接到mysql数据库并且我一直收到此错误:

pi@raspberrypi /var/lib/mysql $ sudo mysql -u root -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

将我的数据库文件移动到外部闪存驱动器(/media/my_flashdrive)后,将所有内容移回/var/lib/mysql

[client]
port            = 3306
socket          = /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket          = /var/run/mysqld/mysqld.sock
nice            = 0

[mysqld]
#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock #ORIGINAL
#socket          = /media/my_flashdrive/mysqldb/mysqld.sock #ADDED
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql #ORIGINAL
#datadir         = /media/my_flashdrive/mysqldb #ADDED
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address           = 127.0.0.1   ###CHANGED

mysql文件夹中所有文件的权限都是root。有人可以解释我在这里做错了吗?

0 个答案:

没有答案