Mysql问题:Can't start server : Bind on unix socket: Permission denied
【URL:来源】http://bbs.linuxpk.com/thread-9632-1-1.html
我们如何查看错误信息呢?在哪里查看呢?应该到/usr/local/mysql/var目录中去找一个带有.err后缀的文件;
[root@bugkill var]# cd /usr/local/myql/var
[root@bugkill var]# more *.err
可能会出现存在下面的错误信息:
031203 14:49:10 mysqld started
031203 14:49:10 Can't start server : Bind on unix socket: Permission denied
031203 14:49:10 Do you already have another mysqld server running on socket: /tmp/mysql.sock ?
031203 14:49:10 Aborting
031203 14:49:10 /usr/local/mysql/libexec/mysqld: Shutdown Complete
031203 14:49:10 mysqld ended
其实这是权限方面的事,我们把权限设置一下就OK了。我们要设置的权限是/usr/local/mysql/var的目录。要设置为777。
方法是:
[root@bugkill mysql-4.1.9]# chmod 755 /usr/local/mysql/var
另外我们要用beinan这个用户来启动mysqld服务器,当然也得改变一下 /usr/local/mysql/var的属性
[root@bugkill mysql-4.1.9]# chown -R bugkill:bugkill /usr/local/mysql/var
[root@bugkill mysql-4.1.9]# su bugkill
How do I fix the following error SQL/DB Error errcode 13 Can't create/write to file?
Problem: The MySQL variable tmpdir is set to a directory that cannot be written to when using PHP to access MySQL.
To verify this, enter MySQL at the command line and type show variables;
You'll get a long list and one of them will read: tmpdir = /somedir/ (whatever your setting is.)
Solution: Alter the tmpdir variable to point to a writable directory.
Steps:
Find the my.cnf file. On *nix systems this is usually in /etc/.
Once found, open this in a simple text editor and find the [mysqld] section.
Under this section, find the tmpdir line. If this line is commented (has a # at the start), delete the # and edit the line so that it reads: tmpdir = /writable/dir where /writable/dir is a directory to which you can write. Some use /tmp, or you might also try /home//.
Save the file.
Shutdown MySQL by typing mysqlshutdown -u -p shutdown.
Start MySQL by going to the MySQL directory and typing ./bin/safe_mysqld &. Usually the MySQL directory is in /usr/local or sometimes in /usr/ on Linux systems.
If none of this make sense and you have someone to administrate your system for you, show the above to them and they should be able to figure it out.
原文:
打开:/etc/my.cnf
tmpdir = /usr/local/mysql/var/tmp 去掉#号
socket = /usr/local/mysql/var/mysql.sock
指向的要有写权限,restart mysql OK!然后再重启mysql服务器。
我们如何查看错误信息呢?在哪里查看呢?应该到/usr/local/mysql/var目录中去找一个带有.err后缀的文件;
[root@bugkill var]# cd /usr/local/myql/var
[root@bugkill var]# more *.err
可能会出现存在下面的错误信息:
031203 14:49:10 mysqld started
031203 14:49:10 Can't start server : Bind on unix socket: Permission denied
031203 14:49:10 Do you already have another mysqld server running on socket: /tmp/mysql.sock ?
031203 14:49:10 Aborting
031203 14:49:10 /usr/local/mysql/libexec/mysqld: Shutdown Complete
031203 14:49:10 mysqld ended
其实这是权限方面的事,我们把权限设置一下就OK了。我们要设置的权限是/usr/local/mysql/var的目录。要设置为777。
方法是:
[root@bugkill mysql-4.1.9]# chmod 755 /usr/local/mysql/var
另外我们要用beinan这个用户来启动mysqld服务器,当然也得改变一下 /usr/local/mysql/var的属性
[root@bugkill mysql-4.1.9]# chown -R bugkill:bugkill /usr/local/mysql/var
[root@bugkill mysql-4.1.9]# su bugkill
How do I fix the following error SQL/DB Error errcode 13 Can't create/write to file?
Problem: The MySQL variable tmpdir is set to a directory that cannot be written to when using PHP to access MySQL.
To verify this, enter MySQL at the command line and type show variables;
You'll get a long list and one of them will read: tmpdir = /somedir/ (whatever your setting is.)
Solution: Alter the tmpdir variable to point to a writable directory.
Steps:
Find the my.cnf file. On *nix systems this is usually in /etc/.
Once found, open this in a simple text editor and find the [mysqld] section.
Under this section, find the tmpdir line. If this line is commented (has a # at the start), delete the # and edit the line so that it reads: tmpdir = /writable/dir where /writable/dir is a directory to which you can write. Some use /tmp, or you might also try /home//.
Save the file.
Shutdown MySQL by typing mysqlshutdown -u -p shutdown.
Start MySQL by going to the MySQL directory and typing ./bin/safe_mysqld &. Usually the MySQL directory is in /usr/local or sometimes in /usr/ on Linux systems.
If none of this make sense and you have someone to administrate your system for you, show the above to them and they should be able to figure it out.
原文:
打开:/etc/my.cnf
tmpdir = /usr/local/mysql/var/tmp 去掉#号
socket = /usr/local/mysql/var/mysql.sock
指向的要有写权限,restart mysql OK!然后再重启mysql服务器。
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/965/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2008-3-27 13:23
评论列表