linux装mysql初始化失败

linux装mysql初始化失败,第1张

启动这个试试

/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

这和两个系统变量有关,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&?YkFg1s

[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


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/8951497.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-23
下一篇 2023-04-23

发表评论

登录后才能评论

评论列表(0条)

保存