linux下安装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 展开
[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]$
这样应该就没有问题了。
试试启动这个:
/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