How to install mysql separately in mysql7.x, and install mysql in mysql7.x
The yum source of CentOS7 does not seem to have MySQL by default. To solve this problem, we need to download the mysql repo source first.
1. Download the mysql repo Source
$ Wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
2. Install the 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 the yum repo source for both mysql:/etc/yum. repos. d/mysql-community.repo,/etc/yum. repos. d/mysql-community-source.repo.
3. Install mysql
$ sudo yum install mysql-server
Follow the steps to install it. However, after the installation is complete, there is no password and you need to reset the password.
4. Reset the password
Before resetting the password, you must first log on
$ mysql -u root
The following ERROR may be reported during logon: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql. sock '(2), because of/var/lib/mysql access permission issues.
The following command changes the owner of/var/lib/mysql to the current user:
$ sudo chown -R openscanner:openscanner /var/lib/mysql
Then, restart the service:
$ service mysqld restart
Next, log on to reset the password:
$ mysql -u rootmysql > use mysql;mysql > update user set password=password(‘123456‘) where user=‘root‘;mysql > exit;
5. Open Port 3306
$ sudo vim /etc/sysconfig/iptables
Add the following content:
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
Save and restart the Firewall:
$ sudo service iptables restart
In this way, other clients can connect to the mysql service.
In step 1, you can perform this operation by entering mysql in the command line to control mysql, and then authorizing remote login.
Grant all privileges on *. * TO 'mysqlname' @ '%' identified by '000000' with grant option; after entering the above, an account WITH the mysql remote connection username mymysqlname and password 123456 is configured.
The above section describes how to install mysql in mysql 7.x. I hope it will be helpful to you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!