show code js

2021年10月14日 星期四

Centos Install Mysql update

 (1)source:

### see: https://dev.mysql.com/downloads/repo/yum/ ###

wget  http://repo.mysql.com/mysql80-community-release-el6-3.noarch.rpm

yum localinstall mysql80-community-release-el6-3.noarch.rpm -y

yum module disable mysql

yum install mysql-community-server -y 

systemctl enable mysqld

systemctl start mysqld

systemctl status mysqld

(2)getpswd:

mysql_secure_installation

grep 'temporary password' /var/log/mysqld.log

login mysql -u root -p, to test and quit

mysql>\s

mysql>quit

(3)set use utf8

nano /etc/my.cnf 

### find:

pid-file=/var/run/mysqld/mysqld.pid

### after add:

-------

init_connect='SET collation_connection = utf8mb4_unicode_ci'

init_connect='SET NAMES utf8mb4'

character-set-server=utf8mb4

#character-set-database=utf8mb4

collation-server=utf8mb4_unicode_ci

skip-character-set-client-handshake

[client]

default-character-set=utf8mb4

[mysql]

default-character-set=utf8mb4

--------

systemctl restart mysqld 

(4)grant(all on db.* to 'ur'@'localhost' identified by `pswd`)

CREATE USER 'ur'@'localhost' IDENTIFIED BY 'pswd';

GRANT ALL PRIVILEGES ON db.* TO 'ur'@'localhost';

flush privileges;