centos7 mysql安装问题

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set host = ’%’ where user = ’root’;
ERROR 1054 (42S22): Unknown column '’root’' in 'where clause'
mysql> update user set host = ’%’ where user = ’root’;
ERROR 1054 (42S22): Unknown column '’root’' in 'where clause'
mysql> update user set host = '%' where user = 'root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)


修改密码
在 vim /etc/my.cnf配置文件中增加

    [mysqld]
    validate_password=off

然后重启mysql 就 ok了.

重新启动mysqld
#/etc/init.d/mysqld restart ( service mysqld restart )
重如果想把密码改回来 进入mysql 执行 5.7的数据库没有了password字段 用的是authentication_string字段
mysql> update mysql.user set authentication_string=password('root') where user='root


CentOS 7 下使用yum安装MySQL5.7.20
pkill -9 mysqld
rpm -qa|grep -i mysql
 yum -y remove
 yum -y remove mysql-community-client-5.6.38-2.el7.x86_64

   [root@localhost ~]# cd /usr/local/src/
   [root@localhost src]# wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm

   [root@localhost src]# rpm -ivh mysql57-community-release-el7-8.noarch.rpm

   [root@localhost src]#  yum -y install mysql-server

4.  启动mysql服务

service mysqld restart

 重置密码

    [root@localhost ~]# grep "password" /var/log/mysqld.log   


支持中文字符
[mysqld]
default-character-set=utf8
[mysql]
default-character-set=utf8
[client]
default-character-set=utf8

猜你喜欢

转载自blog.csdn.net/qq_15551663/article/details/88747316