my.cnf改变datadir,2天仍然没有运气 [英] my.cnf changing datadir, 2days and still no luck

查看:181
本文介绍了my.cnf改变datadir,2天仍然没有运气的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我一直在尝试这个几个小时,这个论坛是我最后的手段
在谷歌搜索数百页。

Hi i have been trying this for hours upon hours, this forum is my last resort sfter googling hundreds of pages.

问题:
对不起长度,但我提供了我尝试的细节

PROBLEM: Sorry for the length but i am supplying in detail of what i have tried

我设置了mysql和它的工作正常,我现在需要更改数据存储指向我的外部高清。

I have set up mysql and its working fine, i now need to change the data-storage to point at my External HD.

使用mac osx没有默认my.cnf所以我复制
my-huge.cnf从/usr/local/mysql-5.1.53-osx10 .6-x86 / support-files,现在如果它有任何赔率我也有一个'mysql'文件夹在本地也。

With mac osx there is no default my.cnf so i copied my-huge.cnf from /usr/local/mysql-5.1.53-osx10.6-x86/support-files, now if it makes any odds i also have a 'mysql' folder in local also.

当我将my-huge.cnf放置到/ etc中时将其重命名为

i将其重命名为my.cnf如指示,

它正常工作如果我不添加一个datadir字段看起来像这样

datadir = / Volumes / Elements /数据库,

i也使用

将我的旧数据复制到我的新位置sudo cp -R -p / var / lib / mysql / Volumes / Elements / database

when i place and rename my-huge.cnf into /etc
i renamed it to my.cnf like instructed,
it works as normal if i dont add a datadir field which looks like this
datadir= /Volumes/Elements/database,
i have also copied my old data to my new location using
sudo cp -R -p /var/lib/mysql /Volumes/Elements/database

除非我添加字段 datadir = / Volumes / Elements / database
my.cnf文件,如果我得到错误

Everything workds fine unless i add the field datadir = /Volumes/Elements/database to the my.cnf file, if i do i get the error

错误2002(HY000):无法通过套接字连接到本地MySQL服务器'/var/lib/mysql/mysql.sock'(2)

my.cnf文件类似于以下

my.cnf file looks like the following

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

GNU nano 2.0.6 File: 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天试图得到这个工作在我的外部

I hope someone can shed light on this, i have an assignment due and have spent 2 days trying to get this working on my external

即使当mysql工作,我键入mysqld我得到错误,如果这是一个问题?

Also even when mysql is working and i type mysqld i get errors if this is an issue?

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$ 

$ b感谢您的时间我希望专家能回答这个

Thanks for your time i hope an expert can answer this

推荐答案

虽然我没有使用 datadir 属性播放,但我已将数据存储位置更改为外部高清,方法是将默认位置安装到它,如下所示:

Though I haven't played with datadir property but I've changed data storage location to the external HD by mounting default location to it as follows:


  • 备份目前的资料目录

  • 删除资料目录中的所有资料

  • mount / var / lib / mysql / data / dev / XXX

  • Backup your current data directory
  • Delete everything from your data directory
  • Mount it to your external HD (mount /var/lib/mysql/data /dev/XXX)

我在Ubuntu服务器上做了。当更改InnoDB特定的目录时,我注意到,一个人必须小心权利(ubuntu的情况下,apparmord)。当mysql无法执行一些文件系统操作时,我发现它的错误消息非常误导。有时,它是非常有帮助的研究它的error.log(/var/log/mysql/error.log在我的情况)。

I've done it at Ubuntu Server. When changing InnoDB specific directories I've noticed that one have to be careful with rights (apparmord in case of ubuntu). When mysql cannot perform some filesystem operation I find its error messages very misleading. Sometimes it is really helpful to study it's error.log (/var/log/mysql/error.log in my case).

希望这有助于您解决您的问题ASAP。

Hope this helps you to resolve your issue ASAP.

这篇关于my.cnf改变datadir,2天仍然没有运气的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆