新装mysql版本 mysql-5.5.56.tar.gz cmake-2.8.6.tar.gz 系统为centos6.8
编译后启动报错 :
Starting MySQL..The server quit without updating PID file ([FAILED]al/mysql/data/iZwz92ycxa8b5l94ufhgbcZ.pid).
tail -f /usr/local/mysql/data/iZwz92ycxa8b5l94ufhgbcZ.err
查看日志文件出现如下一条:
180419 12:27:49 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
经过查阅资料得知。要敲如下命令解决:
cd /usr/local/mysql/scripts/
./mysql_install_db –usrer=mysql datadir=/usr/local/mysql
出现错误:
FATAL ERROR: Could not find ./bin/my_print_defaults (本应该存在于安装mysql目录下)
If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.
If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.
告诉我没有找到 ./bin/my_print_defaults 可在ls -l bin下有
之后百度一下有各种方法其中一种小白没有试过 附上地址:
https://blog.csdn.net/m0_37975886/article/details/78329341?locationNum=7&fps=1
有朋友尝试过还望告诉小白一起学习
我采用的另外一种方法:
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data &
启动:
[root@iZwz92ycxa8b5l94ufhgbcZ bin]# service mysqld start
Starting MySQL.. [ OK ]
因为是新安装所以直接admin形式修改密码 mysqladmin -u root password "密码"
select host, user from user;
+-------------------------+------+
| host | user |
+-------------------------+------+
| 127.0.0.1 | root |
| ::1 | root |
| izwz92ycxa8b5l94ufhgbcz | |
| izwz92ycxa8b5l94ufhgbcz | root |
| localhost | |
| localhost | root |
+-------------------------+------
需要远程连接需要新授权:
进入数据库:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
(百分号也可换成允许访问的ip 配合iptables使用)
flush privileges; 刷新权限