linux下安装mysql初始化时失败

bin/mysqld--initialize--user=mysqlmysqld:Can'tcreatedirectory'/usr/local/mysql/data/'... bin/mysqld --initialize --user=mysql
mysqld: Can't create directory '/usr/local/mysql/data/' (Errcode: 2 - No such file or directory)
2016-01-05T13:01:04.099588Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2016-01-05T13:01:04.099691Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2016-01-05T13:01:04.099819Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-01-05T13:01:04.099892Z 0 [ERROR] Can't find error-message file '/usr/local/mysql/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2016-01-05T13:01:04.100818Z 0 [ERROR] Aborting
展开
 我来答
鸽笔记
推荐于2017-11-26
知道答主
回答量:3
采纳率:100%
帮助的人:3217
展开全部
这和两个系统变量有关,lc_messages_dir and lc_messages, 正常默认是没有问题。这里我们显式指定一下。重新初始化,如下:

[mysql@gebiji.com mysql]$bin/mysqld --initialize --user=mysql --basedir=/mysql/mysql/ --datadir=/mysql/data/ --lc_messages_dir=/mysql/mysql/share --lc_messages=en_US

lc_messages_dir,lc_messages分别用于指定lc messages的位置和语言,执行上面的命令后,日志输出如下:
2016-04 06T06:28:53.750837Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-04-06T06:28:55.082940Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-04-06T06:28:55.576112Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-04-06T06:28:55.818866Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: d6a65fff-fbc0-11e5-80ec-54899872f92d.
2016-04-06T06:28:55.883919Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-04-06T06:28:55.884768Z 1 [Note] A temporary password is generated for root@localhost: ia&?Y;kFg1s;
[mysql@gebiji.com mysql]$

这样应该就没有问题了。
_sunshine_木木1f
2018-03-31 · TA获得超过1.1万个赞
知道小有建树答主
回答量:196
采纳率:100%
帮助的人:28.4万
展开全部

试试启动这个:
/mysql/bin/mysqld_safe &

或者试试:

1,安装mysql
mysql-5.0.41-linux-i686-glibc23.tar.gz 由于mysql是二进制包。所以还是比较方便的。
直接解压。然后移动。
mv mysql-5.0.41-linux-x86_64-glibc23 /usr/local/mysql
cd /usr/local/mysql
groupadd mysql
useradd -g mysql mysql
chown -R mysql .
chgrp -R mysql .
chown -R root .

./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/home/www/mysql/data
cp /usr/local/mysql/support-files/my-huge.cnf /etc/my.cnf
cp /usr/local/mysql/support-files/mysql.server  /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig –add mysqld
chkconfig --level 3 mysqld on
mv /usr/local/mysql/data /home/www/mysql
chown -R mysql:mysql /home/www/mysql

编辑/etc/my.cnf
在 [mysqld] 段增加
datadir = /home/www/mysql
skip-innodb
wait-timeout = 10
max_connections = 512
max_connect_errors = 10000000
在 [mysqld] 段修改
max_allowed_packet = 16M
thread_cache_size = CPU个数*2
将 log-bin 注释
service mysqld start
bin/mysqladmin -u root -p

本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式