【发布时间】:2010-12-01 13:35:40
【问题描述】:
嗨,我已经尝试了好几个小时,这个论坛是我最后的选择 谷歌搜索数百页后。
问题: 对不起,我提供了我尝试过的详细信息
我已经设置了 mysql 并且它工作正常,我现在需要更改数据存储以指向我的外部 HD。
使用 mac osx 没有默认的 my.cnf 所以我复制了 /usr/local/mysql-5.1.53-osx10.6-x86/support-files 中的 my-huge.cnf,现在如果有任何可能,我在本地也有一个“mysql”文件夹。
当我将 my-huge.cnf 放置并重命名为 /etc
我按照指示将其重命名为 my.cnf,
如果我不添加如下所示的 datadir 字段,它会正常工作datadir= /Volumes/Elements/database,
我还使用sudo cp -R -p /var/lib/mysql /Volumes/Elements/database
除非我添加字段 datadir = /Volumes/Elements/database,否则一切正常
到 my.cnf 文件,如果我收到错误消息
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
my.cnf 文件如下所示
Macintosh-100:support-files seanf$ cd /etc
Macintosh-100:etc seanf$ sudo nano my.cnf
Password:
Macintosh-100:etc seanf$ nano my.cnf
Macintosh-100:etc seanf$ my.cnf > /Desktop/blah.txt
-bash: /Desktop/blah.txt: No such file or directory
Macintosh-100:etc seanf$ my.cnf < /Desktop/blah.txt
-bash: /Desktop/blah.txt: No such file or directory
Macintosh-100:etc seanf$ nano my.cnf
GNU nano 2.0.6 文件:my.cnf
# Example MySQL config file for very large systems.
#
# This is for a large system with memory of 1G-2G where the system runs mainly
# MySQL.
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /usr/local/mysql/data) or
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]l
datadir = /Volumes/Elements/database
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer_size = 384M
等等……
我希望有人能阐明这一点,我有一个任务到期,并且花了 2 天时间试图让这个在我的外部工作
即使 mysql 正在工作并且我输入 mysqld 如果这是一个问题,我也会得到错误?
Macintosh-100:lib s$ mysqld
101201 13:31:13 [Warning] '--skip-locking' is deprecated and will be removed in a future >release. Please use '--skip-external-locking' instead.
101201 13:31:13 [Warning] Can't create test file /usr/local/mysql-5.1.53-osx10.6-x86/data>/Macintosh-100.lower-test
101201 13:31:13 [Warning] Can't create test file /usr/local/mysql-5.1.53-osx10.6-x86/data>/Macintosh-100.lower-test
mysqld: Can't change dir to '/usr/local/mysql-5.1.53-osx10.6-x86/data/' (Errcode: 13)
101201 13:31:13 [ERROR] Aborting
101201 13:31:13 [Note] mysqld: Shutdown complete
Macintosh-100:lib s$
感谢您的宝贵时间,我希望专家能回答这个问题
【问题讨论】:
-
你的新数据目录应该由 MySQL 拥有和写入
-
我理解错误> ERROR 2002 (HY000): Can't connect to local MySQL server through socket 取决于mysql服务器没有运行,the solution can be found here。
标签: mysql macos configuration