Install MySQL 8.0.16 on Linux Centos

Foreword:

Because I installed the Centos system on my Linux, this installation uses mirror download and installation for those of us who are not familiar with the Linx operating system, so we only need to enter some simple commands, of course you You can also download the compressed package to complete some initial configuration and installation yourself. If you use this method, you can check some of this blog to install, the author wrote in relative detail: https://blog.csdn.net/github_39533414/article/details/80144890.

Step 1: Check whether MySQL already exists in the system, if it exists, select delete##

I don’t believe in the explanation here. You can read my last blog about how to completely delete the Mysql database.

Address: https://www.cnblogs.com/Can-daydayup/p/10873948.html

Step 2: Download and install MySQL database##

Official website download address: https://dev.mysql.com/downloads/repo/yum/

Choose the red hat version:

Copy the download address:

1. Download mirror

wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

2. Installation image

rpm -ivh mysql80-community-release-el7-3.noarch.rpm

3. Install all updates

yum update

4. Install MySQL service

yum install mysql-server

The third step: MySQL file permissions settings##

chown mysql:mysql -R /var/lib/mysql

Step 4: Initialize MySQL

mysqld --initialize

Step 5: Start the MySQL service and set it to start automatically##

# start up
systemctl start mysqld

# Set automatic startup

systemctl enable mysqld

systemctl daemon-reload

Note that when I start the MySQL service, it prompts:

Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

I think it may have something to do with the installation of MySQL in my system. Solution:

chown mysql:mysql -R /var/lib/mysql

At startup:

service mysqld start

View running status:

systemctl status mysqld

Works perfectly:

Step 6: View the current MsSQL installation version##

mysqladmin --version

Step 7: Set the database password##

Reason: The password will not be set by default after the installation of MySQL, we need to set it ourselves

mysqladmin -u root password "Your password"

I am really a child who is favored by God. I encountered a problem with setting a password:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Generally, this error is caused by a wrong password. The natural solution is to reset the password.
The solution is as follows:

  1. Stop the mysql database: systemctl stop mysqld

  2. Start MySQL with the following command, and start it without checking permissions:
    mysqld --skip-grant-tables &
    If an error is reported, this can be used:
    mysqld --user=root --skip-grant-tables &

  3. Log in to mysql: mysql -u root -p or mysql

  4. Update root password:
    ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
    Prompt when changing the password:
    ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
    Solution:
    Flush privileges: flush privileges;

  5. Refresh privileges: flush privileges;

  6. Exit mysql: exit or quit

  7. Log in to mysql again as root user
    mysql -uroot -p
    Enter password: <Enter the new password 123456>

Step 8: Turn on MySQL remote##

  1. Log in to the database
mysql -u root -p
Then enter the password and press Enter to enter the MySQL database
  1. Create users for remote connection: refer to this blog:

https://jingyan.baidu.com/article/363872ec3263236e4ba16f07.html

  1. Users querying the database
SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
  1. Update the user table: (% means to allow all ip remote access, if you need to specify a specific ip, just write the specific ip)
UPDATE user SET `Host`='%' WHERE `User`='root' LIMIT 1;
  1. Force refresh permissions:
flush privileges;
  1. Use Navicat to connect to the database:

Recommended Posts

Install MySQL 8.0.16 on Linux Centos
Install MySQL on Linux CentOS7 (Windows)
Install MySQL under Linux (CentOS 7)
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
How to install MySQL on CentOS 8
​Install Oracle database on CentOS Linux
Install Jenkins on linux centos (non-docker way)
Install Docker on Centos7
install LNMP on centos7.4
Install Java on Centos 7
Install MySQL5.7 in centos7
Install mysql5.7 under CentOS7
Nodejs install on centos7
Install Node.js on Centos
Install mysql on Ubuntu 14.04
Install mysql8.0.13 version under Linux CentOS7 system
Linux Centos7 install jdk1.8
CentOS 7.2 Yum install MySQL 5.6
CentOS (linux) install PostgreSQL
How to install MySQL on Ubuntu 18.04 (linux)
Centos7 install Mysql8 tutorial
Maven install on centos7
Install MongoDB on CentOS 7
Install Surelog on CentOS8
Centos manually install mysql8
Install mysql under Centos 7
Centos7 install Mysql database
Openjdk install on centos7
Install Jenkins on centos7
Install mysql5.1 under CentOS6.5
install RabbitMQ on centos
Install RabbitMQ on CentOS 7
install Docker on centos6.5
install oracle on centos
Install Elasticsearch 6 on centos7
Install RabbitMQ on CentOS7
Centos 7 install JDK (Linux install jdk)
How to install RPM packages on CentOS Linux
Linux (CentOS7) using RPM to install mysql 8.0.11 tutorial
How to install jdk1.8.0_151 and mysql5.6.38 on centos7.2.1511
Know Linux and install CentOS
centos install mysql through yum
Install ElasticSearch 7.x on CentOS 7
Linux Centos7 install redis tutorial
Install python3 on linux, keep python2
Install docker transfer on Centos7
Install Mysql offline on Ubuntu
Install docker on Centos system
install EPEL repo on centos
Centos6 install mysql 5.7.x series
Install Zabbix 3.4 based on CentOS 7
install virtualbox on centos server
CentOS 6.8 under linux install mongodb