April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Categories

April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

CentOS 7 used rpm install MySQL 5.7

$  wget http://repo.mysql.com/mysql57-community-release-el7-7.noarch.rpm

$ rpm -ivh mysql57-community-release-el7-7.noarch.rpm

[root@cluster1 ~]# rpm -ivh mysql57-community-release-el7-7.noarch.rpm
warning: mysql57-community-release-el7-7.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing…                ########################################### [100%]
1:mysql57-community-relea########################################### [100%]

$  yum install mysql-server

So far, mysql57 has been successfully installed. Now try to log on to use the root mysql, an error ERROR 1045 (28000): Access denied for user ‘root’ @ ‘localhost’

This problem occurs because the occurrence is estimated rpm mode after installing mysql default password used to initialize the root user.

After the degree of your mother get Google solution for 5.7.x version is invalid. The official website to find some ideas https://dev.mysql.com/doc/refman/5.7/en/server-management-using-systemd.html

mysql5.7.x version has some new changes, roughly

1.mysqld_safe has been abandoned, rpm installation package is not installed by default mysqld_safe

2.user table password column has been changed to authentication_string

After many tests and finally solve the root login issues. Resolve as follows

$  systemctl stop mysqld.service

$  systemctl set-environment MYSQLD_OPTS=”–user=mysql –skip-grant-tables –skip-networking”

$  systemctl start mysqld.service

$ mysql -u root mysql

mysql > UPDATE mysql.user SET authentication_string=PASSWORD(“mohan123”)  WHERE user=’root’ and host=’localhost’;

mysql > flush privileges;

mysql > quit

$  systemctl unset-environment MYSQLD_OPTS

$  systemctl restart mysqld.service

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>