mysql download, install and deploy

Centos7 install Mysql

Download the mysql source installation package

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

install mysql source

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

Check if the mysql source is installed successfully

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

Install MySQL

yum install mysql-community-server

Start the MySQL service

systemctl start mysqld

View Mysql startup status

systemctl status mysqld

set startup

systemctl enable mysqld
systemctl daemon-reload

Modify root local login password

grep 'temporary password' /var/log/mysqld.log #获取密码
mysql -uroot -p #登陆
set password for root@localhost = password('Wb:931021.');  //修改密码

password policy

#在/etc/my.cnf文件添加validate_password_policy配置,指定密码策略
# 选择0(LOW),1(MEDIUM),2(STRONG)其中一种,选择2需要提供密码字典文件
validate_password_policy=0
#如果不需要密码策略,添加my.cnf文件中添加如下配置禁用即可:
validate_password = off

Add remote login user

GRANT ALL PRIVILEGES ON *.* TO 'wb'@'%' IDENTIFIED BY 'Yangxin0917!' WITH GRANT OPTION; 
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Wb:931021.' WITH GRANT OPTION;

my.cnf configuration file

[mysqld]

# 数据库目录
basedir = /usr/Gwall/mysql
# 数据存储位置
datadir = /usr/Gwall/mysql/data
# 改变端口
port = 3307
# 忽略大小写
lower_case_table_names = 1
# 字符编码
character_set_server=utf8

Character encoding problem (Chinese garbled characters), you also need to execute the statement in the database and set the character encoding:

show variables like 'character_set_%';
set character_set_database = utf8;
set character_set_server = utf8;
use oms;
status;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324643247&siteId=291194637