yum list no mysql, originally installation package first attempts to use downloaded, but always unsuccessful, so use yum install
1, install mysql
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum update
If not wget, such as a command: yum -y install wget, installation.
Then found looks like a 5.6 version, so look for another article.
2, modify the mysql version of yum.
Another article all of the following, but because I have run the preceding three commands, so the first line of command is not executed.
|
# 安装MySQL5.7
yum
install
mysql-community-server
期间会有很多问,回答y就行。
3, start mysql
Here there have been all kinds of error, press the start of this process is complete.
Permissions (where / var / lib / mysql directory consistent with /etc/my.cnf inside):
[root@host]# chown mysql:mysql -R /var/lib/mysql
Initialization MySQL:
[root@host]# mysqld --initialize
After initialization attention to check the / var / lib / mysql directory and directory permissions to modify all the files are correct, if not modified, then execute this command again in the mysql directory.
Start MySQL:
[root@host]# systemctl start mysqld
View MySQL running state:
[root@host]# systemctl status mysqld
Verify MySQL installation
[root @ host] # mysqladmin --version
4, access mysql
Here also use mysqladmin -u root password '123456' command has been given, can not enter. I found a third article, into the process is as follows:
At this time, MySQL has started running, but in order to enter at this time MySQL had to first find out the root user password, you can find the password in the log file with the following command:
[root@localhost ~]# grep "password" /var/log/mysqld.log
The following command into the database:
[root @ localhost ~] # mysql -uroot -p
input the above-generated temporary initial password, this time can not do anything, because to operate after MySQL database default password must be changed:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
This completes the installation.
5. Other
Installation see if there is installed:
yum list installed mysql*
rpm -qa | grep mysql*
See if there is an installation package:
yum list mysql*
Reference pages:
http://www.runoob.com/mysql/mysql-install.html