更改MySQL数据目录

创建/bi/mysql目录后,修改/etc/my.cnf datadir="/bi/mysql" 
启动mysqld 发现发生以下错误提示:


/etc/init.d/mysqld start
Initializing MySQL database: WARNING: The host 'BGP-LF-DT0229' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...
121101 18:51:56 [Warning] Can't create test file /bi/mysql/BGP-LF-DT0229.lower-test
121101 18:51:56 [Warning] Can't create test file /bi/mysql/BGP-LF-DT0229.lower-test
/usr/libexec/mysqld: Can't change dir to '/bi/mysql/' (Errcode: 13)
121101 18:51:56 [ERROR] Aborting

121101 18:51:56 [Note] /usr/libexec/mysqld: Shutdown complete

Installation of system tables failed! Examine the logs in
/bi/mysql for more information.

You can try to start the mysqld daemon with:

shell> /usr/libexec/mysqld --skip-grant &

and use the command line tool /usr/bin/mysql
to connect to the mysql database and look at the grant tables:

shell> /usr/bin/mysql -u root mysql
    mysql> show tables

Try 'mysqld --help' if you have problems with paths. Using --log
gives you a log in /bi/mysql that may be helpful.

Please consult the MySQL manual section
'Problems running mysql_install_db', and the manual section that
describes problems on your OS. Another information source are the
MySQL email archives available at http://lists.mysql.com/.

Please check all of the above before mailing us! And remember, if
you do mail us, you MUST use the /usr/bin/mysqlbug script!

[FAILED]

按提示运行/usr/libexec/mysqld --skip-grant &
出现以下提示:

[root@BGP-LF-DT0229 mysql]# 121101 18:54:45  InnoDB: Initializing buffer pool, size = 8.0M
121101 18:54:45  InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
121101 18:54:45  InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
121101 18:54:46  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
121101 18:54:46  InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
121101 18:54:46  InnoDB: Started; log sequence number 0 0
121101 18:54:46 [Warning] Can't open and lock time zone table: Table 'mysql.time_zone_leap_second' doesn't exist trying to live without them
121101 18:54:46 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
121101 18:54:46 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.61'  socket: '/bi/mysql/mysql.sock'  port: 3306  Source distribution

再次启动mysqld。 OK

/etc/init.d/mysqld start
Starting mysqld: [ OK ]

发觉启动mysql时发生以下错误:

mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

解决方案:
更改/etc/my.cnf的内容,加上以下内容:

[client]
socket=/bi/mysql/mysql.sock

再次敲入mysql. OK!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值