常用配置

切换清华国内源

wget https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql80-community-el7/mysql80-community-release-el7-3.noarch.rpm
rpm -qa |grep mariadb
yum install mysql-server
systemctl enable mysqld

配置文件 my.cnf

[mysql]
prompt = "\u@mysqldb \R:\m:\s [\d]> "

[mysqld]
datadir = /data/mysql
socket  = /data/mysql/mysql.sock
character_set_server = UTF8MB4
default_time_zone = "+8:00"
plugin_dir = /usr/lib64/mysql/plugin

default_authentication_plugin=mysql_native_password

##performance setttings
lock_wait_timeout = 3600
open_files_limit    = 65535
max_connections = 512
table_open_cache = 1024
table_definition_cache = 1024
thread_cache_size = 768
interactive_timeout = 600
wait_timeout = 600

##log settings

log_timestamps = SYSTEM
log_error = /data/mysql/error.log
slow_query_log = 1
slow_query_log_file = /data/mysql/slow.log
#long_query_time = 0.1

innodb_buffer_pool_size = 45875M
innodb_data_file_path = ibdata1:12M:autoextend
## 根据您的服务器IOPS能力适当调整
## 一般配普通SSD盘的话,可以调整到 10000 - 20000
## 配置高端PCIe SSD卡的话,则可以调整的更高,比如 50000 - 80000
innodb_io_capacity = 4000
innodb_io_capacity_max = 8000
innodb_open_files = 65535

密码配置

1、初始化密码

MySQL 8.0 初始化会自动生成 root 密码,保存在数据库的日志文件中

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

2、修改密码安全等级

set global validate_password.policy=0;

3、默认配置文件 my.cnf

datadir=/wiki/mysql
socket=/var/lib/mysql/mysql.sock

log-error=/var/log/mysqld.log
max_allowed_packet=512M
innodb_log_file_size=2GB
transaction-isolation=READ-COMMITTED
character-set-server=utf8mb4
collation-server=utf8mb4_bin

4、重置 root 密码

mysqld --user=mysql --console --skip-grant-tables
set global validate_password.policy=0;
alter user 'root'@'localhost' identified by 'www.password';

5、添加用户

create user 'confluence'@'localhost' identified with mysql_native_password by 'password';
grant all privileges on confluence.* to 'confluence'@'localhost';
set global validate_password.policy=0;

5、提示“MySQL server is running with the –secure-file-priv”错误

SHOW VARIABLES LIKE "secure_file_priv";

mysql> SELECT * FROM information_schema.processlist into outfile '/tmp/mysql_processes.txt';
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

"ERROR 1419 (HY000): You do not have the SUPER Privilege and Binary Logging is Enabled"

--log-bin-trust-function-creators=1

mkdir -p ~/.pip
cat > ~/.pip/pip.conf <<EOF
[global]
index-url = https://opentuna.cn/pypi/web/simple
trusted-host = opentuna.cn
timeout = 120
[install]
trusted-host = opentuna.cn
EOF
pip3 install --user --timeout=3600 django==2.2.* future mysqlclient pymysql Pillow pylibmc 
pip3 install --user --timeout=3600 captcha jinja2 sqlalchemy==1.4.3 psd-tools django-pylibmc django-simple-captcha
yum install libreoffice libreoffice-headless libreoffice-pyuno

Error: Failed to connect to mysql database ccnet-db: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods

pip3 install --user --upgrade pip
pip3 install --user cryptography



  • 无标签

0 评论

你还没有登录。你所做的任何更改会将作者标记为匿名用户。 如果你已经拥有帐户,请登录