Detailed tutorial on installing mysql database using yum in Centos7 (enhanced version), centos7yum
I have shared this article with you before: detailed explanation of how to install mysql using yum in CentOS 7.0. I think it is not detailed enough. I will give you a supplement through this article today, for more information, see.
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
5. Firewall settings, open port 3306
firewall-cmd --permanent --zone=public --add-port=3306/tcpfirewall-cmd --permanent --zone=public --add-port=3306/udpfirewall-cmd --reload
6. mysql Security Settings
mysql_secure_installation;
MySQL prompts you to reset the root password, remove other user accounts, disable root remote logon, remove the test database, and reload the privilege table.
7. Create a remote access user
-- Environment user create user 'dbuser' @ '%' identified by '000000'; grant select, INSERT, UPDATE, delete on *. * TO 'dbuser' @ '%'; -- administrator user create user 'admin' @ '% 'identified BY '123 '; create user 'admin' @ '%' identified by '2013'; grant all on *. * TO 'admin' @ '%'; flush privileges;
8. Change the data storage directory
Mkdir/home/data -- disable the mysql service process systemctl status mysqldmv/var/lib/mysql/home/data
Modify the/etc/my. cnf File
datadir=/home/data/mysqlsocket=/home/data/mysql/mysql.socksocket=/home/data/mysql/mysql.sock
The above is a detailed tutorial on using yum to install mysql database under Centos7. I hope it will help you. If you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!