标签:初始化 pid server file groupadd -- cat ... bsp
输入命令: groupadd mysql
输入命令:useradd -r -g mysql mysql
输入命令:passwd mysql
tar -zxvf mysql.tar
备份my.cnf
拷贝my.cnf
输入命令:vi /etc/my.cnf
更改:
[mysql]
default-character-set=utf8
[mysqld]
default-storage-engine=INNODB
character_set_server=utf8
输入命令:vim /etc/init.d/mysql
更改:basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
输入命令:chown -R mysql:mysql /usr/local/mysql/
老命令./mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
新命令:./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
输入命令:./mysqld_safe --user=mysql &
&符号:把当前进程丢给后台
查看初始化自动生成的密码:cat /root/.mysql_secret
进入mysql:bin/mysql -uroot -p (把刚刚复制的密码粘贴上来)
登录后重置root密码
mysql> SET PASSWORD FOR ‘root‘@localhost = PASSWORD(‘123456‘);
解决办法:
(1)因为排查中,无错误日志,所以暂时采取补充目录的方式
mkdir -p /var/lib/mysql
chown mysql:mysql /var/lib/mysql
(2)补充目录之后,出现Can‘t open and lock privilege tables: Table ‘mysql.user‘ doesn‘t exist
My.ini中datadir路径错误 更改路径
查询日志:发现: The error means mysqld does not have the access rights to the directory.
更改权限: chmod -R 777
出现新问题:Can‘t open the mysql.plugin table. Please run mysql_upgrade to create it.
解决办法:使用老命令重新初始化
问题所在:my.ini中 character_set_server=utf8写错
之前更改问题的时候,my.ini被改错datadir=/usr/local/mysql/data
标签:初始化 pid server file groupadd -- cat ... bsp
原文地址:http://www.cnblogs.com/bqwzy/p/7747133.html