Home  >  Article  >  Operation and Maintenance  >  How to use yum to install mysql on centos6

How to use yum to install mysql on centos6

WBOY
WBOYOriginal
2022-05-19 15:31:192919browse

Method: 1. Use the "yum -y install mysql" command to install mysql from the yum library; 2. Use the "rpm -qi mysql-server" command to verify whether the installation is successful; 3. Use "service mysqld start "Command to start mysql.

How to use yum to install mysql on centos6

The operating environment of this tutorial: centos 6.5 system, mysql8.0.22 version, Dell G3 computer.

How to use yum to install mysql in centos6

1. Install mysql from the yum library

Enter the command:

yum list | grep mysql
yum -y install mysql mysql-server mysql-devel

2. Verify whether the installation is successful

Enter the command:

rpm -qi mysql-server

3. Start the MySql service

Enter the command:

service mysqld start

Extended knowledge:

1. Check whether mysql has been installed under CentOS

Enter the command:

yum list installed | grep mysql

2. Delete the installed mysql

Enter the command:

yum -y remove mysql

If there is: remove other files too

yum -y remove mysql-libs.x86_64
yum -y remove mysql5.7-community-release.noarch

Seeing complete means success

Log in to MySql and change the password

Enter the command: mysql -u root

If ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' error occurs , it may be that the service is not turned on, or it may be an access permission issue with /var/lib/mysql.

If the service is not started: service mysqld start

If it is an access permission problem: chown -R openscanner:openscanner /var/lib/mysql

Change password

mysql > use mysql;
mysql > update user set password=password("123456") where user="root";

Query and change password:

mysql>select user,password from mysql.user;

Set up startup

Command:

chkconfig mysqld on

Open port 3306

Enter command: vim /etc/sysconfig /iptables

Add: -A INPUT -p tcp -m state –state NEW -m tcp –dport 3306 -j ACCEPT

Then restart the firewall: service iptables restart

Recommended tutorial: "centos tutorial"

The above is the detailed content of How to use yum to install mysql on centos6. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn