Linux uses rpm to create mysql8

Database package download: https: //pan.baidu.com/s/1U1x_HSiLBzlcR6HLTRoF8g 
extraction code: b5vt

After the download is uploaded to the server, the directory is to put my / usr / local

Install mysql steps:

Environmental clean-up

centos7 will own a mariadb

To see if you have installed

rpm -qa |grep -i mysql

centos7 default system comes

rpm -qa |grep -i mariadb

mariadb mysql come from, is one of its branches, need to be cleaned out

Clean out mariadb package

Yum install you directly, then use the yum source mariadb, which is not the same with mysql official version, we have to install the official version, you need to clear out mariadb, and then manually install their own official version of mysql download

rpm -e plus package name, the package cleared mariadb

Rpm can be seen with the deletion will fail, suggesting the need to install software dependencies

rpm -e mariadb-libs-5.5.64-1.el7.x86_64

When rpm deleted if there are dependencies, you can use yum remove + package name to delete mariadb

yum remove mariadb-libs-5.5.64-1.el7.x86_64

Decompression mysql-8.0.16-2.el7.x86_64.rpm-bundle.tar uploaded

tar -xvf  mysql-8.0.16-2.el7.x86_64.rpm-bundle.tar

start installation:

General use software installed with yum install directly can, but there is a problem: with yum, then, is to use the default mariadb yum source to find, could not be found, so our own install

 

rpm -ivh + package installation packages needed

 

rpm -ivh mysql-community-common-8.0.16-2.el7.x86_64.rpm

rpm -ivh mysql-community-libs-8.0.16-2.el7.x86_64.rpm

rpm -ivh mysql-community-libs-compat-8.0.16-2.el7.x86_64.rpm

rpm -ivh mysql-community-client-8.0.16-2.el7.x86_64.rpm

rpm -ivh mysql-community-server-8.0.16-2.el7.x86_64.rpm

Now MySQL has been installed

The default configuration file path: 
Profile: /etc/my.cnf 
log file: /var/log/var/log/mysqld.log 
service startup script: /usr/lib/systemd/system/mysqld.service 
socket file: / var /run/mysqld/mysqld.pid

Check whether the installation is successful mysql, mysql to see representatives of relevant recent successful installation

 rpm -qa | grep -i mysql

See if there mysql process

ps -ef | grep mysql

Start Service 

systemctl start mysqld.service

View mysql service is started

ps -ef | grep mysql

mysql installation is successful, delete the installation package (optional):

rm -rf mysql-*

After the MySQL root will start to generate a random initial password

 grep "password" /var/log/mysqld.log

 

Log database:

mysql -u root -p

Then enter a random password knockout round

Information will be prompted to log in at: as connecting thread id, version of what

Before using to set its own password, if not set it will be required to set

To see what the library database

show databases;

Password rules: uppercase letters lowercase letters + numbers + + special symbol combination, otherwise it will error, as follows

change Password:

alter user 'root'@'localhost' identified by 'Aliwang!123';

View library again

show databases;

Create a user: CREATE USER 'username' @ '%' IDENTIFIED BY 'password'; 

CREATE USER 'mysql'@'%' IDENTIFIED BY 'Mysql2020!'; 

Authorization: GRANT ALL PRIVILEGES ON * * TO 'username' @ '%' WITH GRANT OPTION;

GRANT ALL PRIVILEGES ON *.* TO 'mysql'@'%' WITH GRANT OPTION;

Execution flush privileges; command take effect immediately

flush privileges;

 

If you want to set the root user can remotely access the following settings:


Use mysql database:

use mysql;


 

Modify a specific user host:

update user set host='%' where user='root';


 

Specifies the user's authorization 

grant all privileges on mysql.* to root@'%';

Execution flush privileges; command take effect immediately

flush privileges;

Exit MySQL

exit

At this point, the entire configuration is complete mysql

 

mysql library will be built some systems:

information_schema keep some statistics

performance_schema keep some state data,

mysql stored data for monitoring, permissions, accounts, etc.

test test library for test purposes

 

If you reinstall, data directory has not changed, then before the library still exists

Published 11 original articles · won praise 0 · Views 139

Guess you like

Origin blog.csdn.net/u012590718/article/details/104901915