1 Change the network mode of the virtual machine to bridge mode, restart the virtual machine, and change the connection to obtain ip automatically. (As long as the virtual machine can access
the Internet) 2 Download mysql repo resources
$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
3 Install mysql-community-release-el7- 5.noarch.rpm package
$ sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm After
installing this package, you will get two mysql yum repo sources: /etc/yum.repos.d/mysql- community.repo, /etc/yum.repos.d/mysql-community-source.repo
4 Install mysql
$ sudo yum install mysql-server
5 Start mysql
$ service mysqld start
6 Login, change the password No password is required for the
first login $ mysql - u root
mysql > use mysql;
mysql > update user set password=password('root') where user='root';
mysql > exit;
$ service mysqld restart
7 Open port 3306
firewall-cmd --zone=public --add-port=3306/tcp --permanent
After success, execute $ firewall-cmd --reload
(systemctl stop firewalld.service #stop
systemctl disable firewalld.service #disable)
8 mysql installation After that, you must allow remote connections so that other servers can connect to the local database.
mysql -u root -p //
Whether remote connection is not allowed for logging in to MySQL mysql account. If you cannot connect, you can try the following methods:
mysql -u root -p //Log in to MySQL
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION; //Any remote host
can access the database
Note : GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION; //Any remote host can access the database with the root account
mysql> FLUSH PRIVILEGES; //You need to enter this command to make the changes take effect
mysql > EXIT //Exit
Install mysql under Centos7
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=326835910&siteId=291194637
Recommended
Ranking