How to use yum to install mysql on centos6

WBOY
Release: 2022-05-19 15:31:19
Original
2748 people have browsed it

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
Copy after login

2. Verify whether the installation is successful

Enter the command:

rpm -qi mysql-server
Copy after login

3. Start the MySql service

Enter the command:

service mysqld start
Copy after login

Extended knowledge:

1. Check whether mysql has been installed under CentOS

Enter the command:

yum list installed | grep mysql
Copy after login

2. Delete the installed mysql

Enter the command:

yum -y remove mysql
Copy after login

If there is: remove other files too

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

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";
Copy after login

Query and change password:

mysql>select user,password from mysql.user;
Copy after login

Set up startup

Command:

chkconfig mysqld on
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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 [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!