Centos7 install Mysql database

The installation environment is as follows:

 Centos 7.464 people
 Mysql 5.7

View MYSQL Yum version

Download and install MySQL Yum

After ssh connects to the target server, use wget to download version 5.7 of MySQL Yum

wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

Then install MySQL Yum with yum

yum localinstall mysql57-community-release-el7-8.noarch.rpm

Then use the command to check whether MySQL Yum is installed successfully

yum repolist enabled | grep "mysql.*-community.*"

After the installation is successful, you will see the following prompt.

image

Install MySQL

yum install mysql-community-server

Start MySQL

systemctl start mysqld
//And so on
systemctl stop mysqld
systemctl restart mysqld

//The second, easy to remember
service msyqld start
service msyqld stop
service msyqld restart

Set to start MySQL

systemctl enable mysqld
systemctl daemon-reload

Modify MySQL password####

Because after installation, the default password will be automatically generated for root, we use the following command to view the password, 5ejRwZBgquL is the default password.

[ root@VM_65_249_centos ~]# grep 'temporary password'/var/log/mysqld.log
2018- 06- 13 T04:04:42.144765Z 1[Note] A temporary password is generated for root@localhost: #5ejRwZBgquL

log in###

mysql -u root -p 

change Password####

Because mysql has a password security check plugin, your password must contain uppercase and lowercase English, numbers, characters and no less than 8 digits. Note that it ends with an English semicolon. Otherwise, the following error will be reported.

set password for'root'@'localhost'=password('YourNewPassword123!');
ERROR 1819(HY000): Your password does not satisfy the current policy requirements //Does not pass the password security plug-in check

Remote Connection####

Because the root user prohibits remote connections by default, you can change the policy to allow root to connect remotely, or create new users to connect remotely. For safety, create a new user ppjun

GRANT ALL PRIVILEGES ON *.* TO 'ppjun'@'%' IDENTIFIED BY 'YourNewPassword123!' WITH GRAN;

The meaning here is to let the user ppjun assign permissions to all tables in all databases of the machine, and set the password YourNewPassword123!

Configure the default UTF8 encoding####

vi /etc/my.cnf 

Add under [mysqld]

[ mysqld]
character_set_server=utf8
init_connect='SET NAMES utf8'

Then in mysql, the encoding is utf8

mysql> show variables like '%character%';+--------------------------+----------------------------+| Variable_name            | Value                      |+--------------------------+----------------------------+| character_set_client     | utf8                       || character_set_connection | utf8                       || character_set_database   | utf8                       || character_set_filesystem | binary                     || character_set_results    | utf8                       || character_set_server     | utf8                       || character_set_system     | utf8                       || character_sets_dir       |/usr/share/mysql/charsets/|+--------------------------+----------------------------+8 rows inset(0.00 sec)

the above.

Recommended Posts

Centos7 install Mysql database
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
CentOS6.5 offline install MySQL5.6.26
Install MySQL5.7 in centos7
Install mysql5.7 under CentOS7
CentOS 7.2 Yum install MySQL 5.6
Centos7 install Mysql8 tutorial
Centos manually install mysql8
Install mysql under Centos 7
Install mysql5.1 under CentOS6.5
Install mysql online on centos
centos install mysql through yum
Install MySQL 8.0.16 on Linux Centos
Install Oracle11gR2 database under CentOS6.9
Install MySQL under Linux (CentOS 7)
Centos6 install mysql 5.7.x series
1.5 Install Centos7
Install MongoDB database under CentOS7
CentOS8 install MySQL8 (pro test)
How to install MySQL on CentOS 8
CentOS7 yum install and start mysql
CentOS Yum compile and install MySQL 5.6
CentOS 7 install Nginx, PHP, MySQL packages
Install MySql with Docker in CentOS7
CentOS7 yum install and start mysql
Centos7 and centos8 install mysql5.6 5.7 8.0 so simple
Centos yum install mysql5.6 or above
​Install Oracle database on CentOS Linux
CentOS7.2 install lepus database monitoring system
centos7 .*tar package to install MySQL5.7
Centos7 mysql database installation and configuration
Centos6 install Python2.7.13
Centos7.3 install nginx
CentOS install Redmine
Centos7 install Python 3.6.
Centos7 install protobuf
CentOS7 install GlusterFS
CentOS 7.4 install Zabbix 3.4
Centos6.5 install Tomcat
CentOS install Python 3.6
Vmware install CentOS6
centos7 install docker-ce 18.01.0
CentOS 7.2 install MariaDB
CentOS 7 install Hadoop 3.0.0
Centos7 install Python2.7
Centos 7.6 install seleniu
CentOS 7.3 install Zabbix3
Centos7 install LAMP+PHPmyadmin
CentOS install openjdk 1.8
CENTOS6.5 install CDH5.12.1 (1)
CentOS install PHP
CentOS6 install mist.io
Centos7 install Docker
centOs install rabbitMQ