Home > Operation and Maintenance > Linux Operation and Maintenance > How to use yum to install mysql under linux

How to use yum to install mysql under linux

WBOY
Release: 2022-06-07 17:03:11
Original
5235 people have browsed it

Method: 1. Use the yum command to confirm whether the built-in mysql is installed. If installed, you need to uninstall it first; 2. Use the "yum-y install mysql" command to install it. If Complete is displayed, the installation is complete; 3. Use Mysql can be used after "service mysql start" is started.

How to use yum to install mysql under linux

The operating environment of this article: centos 8 system, mysql5.5.7 version, Dell G3 computer.

How to use yum to install mysql under linux

1. Check whether the mysql that comes with CentOS has been installed.

Input:

yum list installed | grep mysql
Copy after login

2. If there is mysql installed, how to uninstall the mysql database that comes with the CentOS system?

Input:

yum -y remove mysql-libs.x86_64
Copy after login

If there are multiple dependent files, uninstall them one by one.

When the result is displayed as Complete! The uninstallation is complete.

3. Check the mysql version information on the yum library (CentOS system needs to be connected to the network normally).

Input:

yum list | grep mysql 或 yum -y list mysql*
Copy after login

4. Use yum to install the mysql database.

Enter:

yum -y install mysql-server mysql mysql-devel
Copy after login

The command will install: mysql-server, mysql, and mysql-devel. When the result is displayed as "Complete!", the installation is complete.

(Note: Installing mysql only installs the database, only installing mysql-server is equivalent to installing the client.)

5. Check the version information of the mysql database you just installed.

Input:

rpm -qi mysql-server
Copy after login

(Note: Mysql is only installed at this time. If you want to use it, you need to start mysql first.)

The following are the login steps!

Startup instructions:

1. Start using service:

[root@localhost /]# service mysqld start (5.0版本是mysqld)
[root@szxdb etc]# service mysql start (5.5.7版本是mysql)
Copy after login

2. Start using mysqld script:

/etc/inint.d/mysqld start
Copy after login

3. Start using safe_mysqld:

safe_mysqld&
Copy after login

(Note: After successful startup, press enter: mysql to enter directly )

Add new users after entering

insert into mysql.user(Host,User,Password) values("localhost","xxx",password("***"));
Copy after login

( Note: xxx is the new user name, *** is the user password)

You can use this user to enter mysql in the future, format: mysql -u account -p password

Related recommendations: " Linux video tutorial

The above is the detailed content of How to use yum to install mysql under linux. 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 admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template