How to install mysql on centos7 system
This article mainly introduces how to install mysql centos7 system, the content of the article is carefully selected and edited by the author, with certain pertinence, the reference significance for everyone is still relatively large, the following with the author to understand how to install mysql centos7 system.
Reference to the following two links
http://www.centoscn.com/mysql/2016/0315/6844.html Link A
http://www.cnblogs.com/starof/p/4680083.html Link B
centos7 no longer installs mysql by default, mariadb by default, yum install mysql on the command line to see the prompt to download mariadb.
Mariadb installation can be described in Parameter Link B
Here is the mysql installation method taken from link A.
Add a file mysql-community.repo to the/etc/yum.repos.d directory with the following contents
#Enble to use MySQL 5.6[mysql56-community]name=MySQL 5.6 Community Serverbaseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/enabled=1gpgcheck=0gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
On the command line, type,yum install mysql-community-server, that is, you can install mysql, mysql5.6 installed, if mariadb is installed in the system,mysql installation will also remove mariadb.
There was also a problem during installation
The requested URL/pki/rpm-gpg/RPM-GPG-KEY-mysql was not found on this server.
Reference here.
http://www.2cto.com/database/201701/586216.html
Change gpgcheck=1 to gpgcheck=0 in/etc/yum.repos.d/mysql-community.repo.
This is why the file above differs from the file in link A.
start the MySQL
systemctl start mysqld.service
mysql is installed for the first time. the root account has no password. you need to set it up.
mysql -h localhost -u root -p Enter mysql
I'm having trouble setting my password.
mysql> set password for 'root'@'localhost' = password('123456');ERROR 1133 (42000): Can't find any matching row in the user table
solution
mysql> grant all on mysql.user to 'root'@'%' identified by 'password';Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)mysql> update mysql.user set password=password('123456') where user ='root';Query OK, 5 rows affected (0.00 sec)Rows matched: 5 Changed: 5 Warnings: 0mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)
After reading the above on how to install mysql centos7 system, many readers must have some understanding, if you need to obtain more industry knowledge information, you can continue to pay attention to our industry information column.