Home>Article>Operation and Maintenance> How to use yum to install mysql under linux
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.
The operating environment of this article: centos 8 system, mysql5.5.7 version, Dell G3 computer.
1. Check whether the mysql that comes with CentOS has been installed.
Input:
yum list installed | grep mysql
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
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*
4. Use yum to install the mysql database.
Enter:
yum -y install mysql-server mysql mysql-devel
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
(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)
2. Start using mysqld script:
/etc/inint.d/mysqld start
3. Start using safe_mysqld:
safe_mysqld&
(Note: After successful startup, press enter: mysql to enter directly ef07533db2c747f7411a8f21afda590d)
Add new users after entering
insert into mysql.user(Host,User,Password) values("localhost","xxx",password("***"));
( 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!