1. 程式人生 > 資訊 >B站處置部分涉國際局勢言論,倡議理性發布涉國際熱點事件資訊

B站處置部分涉國際局勢言論,倡議理性發布涉國際熱點事件資訊

1.建立掛載路徑

mkdir -p /docker/mysql/conf /docker/mysql/data /docker/mysql/logs

2.新建my.cnf

 1 [client]
 2 
 3 #socket = /usr/mysql/mysqld.sock
 4 
 5 default-character-set = utf8mb4
 6 
 7 [mysqld]
 8 
 9 #pid-file        = /var/run/mysqld/mysqld.pid
10 
11 #socket          = /var/run/mysqld/mysqld.sock
12 
13 #datadir         = /var/lib/mysql
14 15 #socket = /usr/mysql/mysqld.sock 16 17 #pid-file = /usr/mysql/mysqld.pid 18 19 character_set_server = utf8mb4 20 21 collation_server = utf8mb4_bin 22 23 secure-file-priv= NULL 24 25 # Disabling symbolic-links is recommended to prevent assorted security risks 26 27 symbolic-links=0 28 29 # Custom config should go here
30 31 !includedir /etc/mysql/conf.d/

3.建立容器

1 docker run --name mysql \
2     -v /docker/mysql/conf/my.cnf:/etc/mysql/my.cnf \
3     -v /docker/mysql/data:/var/lib/mysql \
4     -v /docker/mysql/logs:/var/log/mysql \
5     -p 3306:3306 \
6     -e MYSQL_ROOT_PASSWORD=123456 \
7     -d mysql:8.0.25

4.修改許可權

1 ALTER USER 'root
'@'%' IDENTIFIED WITH mysql_native_password BY '123456'; 2 3 FLUSH PRIVILEGES;

5.測試