Install MySQL on Linux

Install MySQL on Linux

Install MySQL

1. View the list of installed MariaDB

rpm -qa | grep mariadb
Insert picture description here


2. Uninstall all installed MariaDB (execute according to your own MariaDB list)

rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64
rpm -e --nodeps mariadb-5.5.68-1.el7.x86_64
rpm -e --nodeps mariadb-devel-5.5.68-1.el7.x86_64

3. Check the list of installed MariaDB again to ensure that all are uninstalled

rpm -qa | grep mariadb

4. Download the repo source of mysql

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
Insert picture description here


5. Install mysql-community-release-el7-5.noarch.rpm

sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
Insert picture description here


6. Install mysql

sudo yum install mysql-server
Insert picture description here


7. Start mysql

service mysqld start
Insert picture description here

Basic operation of MySQL database

1. Database password setting

mysqladmin -u root -p password 'root'

2. Create a database

create DATABASE ke;