CentOS 7安装MySql5.7问题

mysql

报错Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.需要在/etc/my.cnf中添加


[mysqld]

user=mysql # 使用mysql用户

 

报错Access denied for user 'root'@'localhost' (using password:YES),需要修改密码

首先配置/etc/my.cnf中添加



[mysqld]

skip-grant-tables=1# 略过密码验证

 

然后systemctl restart mysqld重启后进入mysql




use mysql;

update user set password=password("*******") where user="*******";  #修改密码报错

 

报错ERROR 1054 (42S22): Unknown column 'password' in 'field list' 5.7版本下的mysql数据库下已经没有password这个字段了,password字段改成了authentication_string



update mysql.user set authentication_string=password('*******') where user='*******';  #修改密码成功

flush privileges;  #立即生效

 

在mysql命令行报错ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.



SET PASSWORD = PASSWORD('123456');

ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;

flush privileges;

 

phpmyadmin

报错:配置文件现在需要一个短语密码。

在 phpMyAdmin 文件中找到一个文件“config.sample.inc.php”,这是phpMyAdmin配置文件的样本文件,我们需要把该文件复制,然后重命名为“config.inc.php”,config.inc.php是phpMyAdmin的配置文件,编辑器打开 config.inc.php 搜索下面一行代码$cfg['blowfish_secret'] = '';,将后面单引号里面随便填入个字符串即可,打开phpMyAdmin/libraries/config.default.php文件$cfg['blowfish_secret'] = '';修改为同样密码


报错:$cfg['TempDir'] (./tmp/) 读取失败且不能建立缓存, phpMyAdmin运行速度将受影响.

手动在phpmyadmin的根目录建立tmp文件,赋予读写权限即可。


-报错:mysqli_real_connect(): Headers and client library minor version mismatch. Headers:50556 Library:50637···

根据安装php版本先删除php-mysqlyum remove php-mysql,然后安装php-mysqlnd,我的php事7.2所以用yum install php72w-mysqlnd

最后killall php-fpm然后再次启动php-fpm即可