Linux (CentOS7) using RPM to install mysql 8.0.11 tutorial

1. Installation preparations##

1、 View Linux related information (Linux command line operation)

(1) Check the Linux version to download the corresponding mysql.

[View Linux information:] uname -a

(2) Check whether mysql has been installed.

[Check whether mysql is installed]
rpm -qa | grep -i mysql If installed, the relevant package name will be output
[If mysql has been installed, delete related files]
rpm -e [–nodeps] package name (where the package name is the name found by the above command)

2、 Download mysql

(1) Official website address

[Official website address:]
https://downloads.mysql.com/archives/community/
https://downloads.mysql.com/archives/get/p/23/file/mysql-community-libs-8.0.11-1.el7.x86_64.rpm
https://downloads.mysql.com/archives/get/p/23/file/mysql-community-common-8.0.11-1.el7.x86_64.rpm
https://downloads.mysql.com/archives/get/p/23/file/mysql-community-server-8.0.11-1.el7.x86_64.rpm
https://downloads.mysql.com/archives/get/p/23/file/mysql-community-client-8.0.11-1.el7.x86_64.rpm

(2) Choose the right version

【Choose the right rpm package】
mysql-community-common-8.0.11-1.el7.x86_64.rpm
mysql-community-libs-8.0.11-1.el7.x86_64.rpm
mysql-community-server-8.0.11-1.el7.x86_64.rpm
mysql-community-client-8.0.11-1.el7.x86_64.rpm

Two, start installation##

1、 Transfer files to the /opt directory###

Use xFtp6 to transfer the downloaded file from the windows system to the Linux system (optional operation, you can download it directly on Linux).

2、 RPM install mysql

(1) Step1: Execute the installation command

rpm -ivh package name
[Installation sequence: (packages depend on each other, so you must pay attention to the installation sequence)]
 Install common first
 Reinstall libs (make sure that mariadb has been uninstalled, centos7 supports mariadb by default, does not support mysql, there will be conflicts if it is not uninstalled)
 Reinstall client
 Finally install the server
 [ root@localhost opt]# rpm -ivh mysql-community-common-8.0.11-1.el7.x86_64.rpm
 [ root@localhost opt]# rpm -e --nodeps mariadb-libs-5.5.64-1.el7.x86_64
 [ root@localhost opt]# rpm -ivh mysql-community-libs-8.0.11-1.el7.x86_64.rpm
 [ root@localhost opt]# rpm -ivh mysql-community-client-8.0.11-1.el7.x86_64.rpm 
 [ root@localhost opt]# rpm -ivh mysql-community-server-8.0.11-1.el7.x86_64.rpm

(2) Step2: Check whether the installation is successful

【method one:】
After mysql is successfully installed, the mysql user and user group will be created automatically.
cat /etc/passwd | grep mysql
cat /etc/group | grep mysql
【Method 2:】
mysqladmin –version

3、 Start mysql service###

(1) Step1: Check whether the current service is started

【method one:】
ps -ef | grep mysql
【Method 2:】
service mysqld stauts

(2) Step2: Start and stop the mysql service

[Start mysql service:]
service mysql start
[Close mysql service: (optional operation)]
service mysql stop

4、 Connect to mysql

An error was reported when connecting to the database for the first time.

【First login:】
mysql
[If an error message is prompted: (indicating a password is required)]
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)

(1) Solution 1: Check the initial password and log in with it.

[Solution 1: (Check the initial password for login)]
cat /var/log/mysqld.log | grep password

(2) Solution two:

[Solution 2: (Edit my.cnf file to skip the password)]
Find the mysql configuration file (end with .cnf).
find / -name “*/.cnf”
or:
mysql –help |grep -A 1 ‘Default options’
Edit the configuration file (my.cnf), find [mysqld], and add
skip-grant-tables # Used to skip password login
Restart the service:
service mysqld restart
No password required for login:
mysql

5、 Modify initial password###

Through the above two methods, you can enter mysql, but the password is the initial password, or there is no password, which is definitely difficult to operate. A custom password is required.
(1) Set the login password and connect to the database again.

【set password:】
mysql> ALTER USER root@localhost IDENTIFIED BY ‘123456’;
[If there is an error:]
ERROR 1290 (HY000): The MySQL server is running with the –skip-grant-tables option so it cannot execute this statement
[Solution: (Execute the following statement)]
mysql> flush privileges;
mysql> ALTER USER root@localhost IDENTIFIED BY ‘123456’;
[Login again]
mysql -uroot -p

(2) After setting the initial password, you need to edit /etc/my.cnf, and remove the skip-grant-tables added before.
Restart the service.

[ root@localhost /]# vim /etc/my.cnf
[ root@localhost /]# service mysqld restart

Recommended Posts

Linux (CentOS7) using RPM to install mysql 8.0.11 tutorial
Centos7 install Mysql8 tutorial
How to install RPM packages on CentOS Linux
Linux Centos7 install redis tutorial
Install MySQL 8.0.16 on Linux Centos
Install MySQL under Linux (CentOS 7)
How to install MySQL on CentOS 8
Install MySQL on Linux CentOS7 (Windows)
centos7 .*tar package to install MySQL5.7
Use VMware15 to install Linux (CentOS6.5)
CentOS7.2 install Mysql5.7.13
CentOS7 install MySQL
CentOS install mysql
CentOS7 install mysql
CentOS 7 install MySQL 5.6
CentOS8 install MySQL8.0
CentOS7 install mysql8
CentOS7 install MySQL8
centos 7.5 install mysql5.7.17
Install mysql8.0.13 version under Linux CentOS7 system
How to install MySQL on Ubuntu 18.04 (linux)
Centos8 use yum to install rabbitmq tutorial
CentOS7 system yum way to install MySQL5.7
CentOS8 deploys LNMP environment to compile and install mysql8.0.29 tutorial details
CentOS Discovery Road 2---Use rpm to install JDK
CentOS6.5 offline install MySQL5.6.26
Install MySQL5.7 in centos7
Centos install MYSQL8.X tutorial
Install mysql5.7 under CentOS7
Linux Centos7 install jdk1.8
CentOS 7.2 Yum install MySQL 5.6
CentOS (linux) install PostgreSQL
Centos7 install kubernetes tutorial
Centos manually install mysql8
Install mysql under Centos 7
Centos7 install Mysql database
How to install jdk1.8.0_151 and mysql5.6.38 on centos7.2.1511
Install mysql5.1 under CentOS6.5
How to install Linux CentOS 7.7 system through VMware
Linux CentOS 7 installation tutorial
Centos 7 install JDK (Linux install jdk)
How to quickly install docker on Linux (Centos version)
Install mysql online on centos
Know Linux and install CentOS
centos install mysql through yum
Centos7.6 method to install Tomcat-8.5.39
vmware install CentOS 7 detailed tutorial
Centos6 install mysql 5.7.x series
5.1. CentOS@ install JDK1.8 graphic tutorial
CentOS 6.8 under linux install mongodb
CentOS 7 yum install PHP7.3 tutorial
CentOS8 install MySQL8 (pro test)
Install Mesos tutorial under CentOS7
How to install JDK and Mysql on Ubuntu 18.04 linux system
How to install jdk1.8 on centOS7
CentOS7 yum install and start mysql
Install JDK8 in rpm on CentOS7
How to install MySQL on Ubuntu 20.04
CentOS Yum compile and install MySQL 5.6
How to install Memcached on CentOS 8
How to install R on CentOS 8