标签:png default login comm storage top unicode 生成 vim
$ sed -i s#SELINUX=enforcing#SELINUX=disabled#g /etc/selinux/config
$ setenforce 0
$ systemctl stop firewalld
$ systemctl disable firewalld.service
$ rpm -qa |grep mysql
$ yum remove mysql*
$ rpm -qa |grep mariadb
$ yum remove mariadb*
$ mkdir -p /opt/src && cd /opt/src
$ rz mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
$ tar xf mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
$ mv mysql-5.7.26-linux-glibc2.12-x86_64 mysql-5.7.26
# 创建软连接便于数据库升级
$ ln -s /opt/src/mysql-5.7.26 /usr/local/mysql
# 安装依赖
$ yum install -y libaio*
$ cd /usr/local/mysql
$ useradd -s /sbin/nologin mysql
$ mkdir -p /data/mysql
$ chown mysql.mysql /data/mysql -R
# 初始化并生成默认密码
$ ./bin/mysqld --initialize --user=mysql --datadir=/data/mysql
[Note] A temporary password is generated for root@localhost: =aCHc<qQz9wu
# 检查初始化是否成功
$ echo $?
# 设置环境变量
$ echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
$ source /etc/profile
$ vim /etc/my.cnf
basedir = /usr/local/mysql
port=3306
datadir = /data/mysql
socket = /tmp/mysql.sock
max_allowed_packet = 512M
max_connections = 2048
open_files_limit = 65535
default_storage_engine = InnoDB
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect=‘SET NAMES utf8mb4‘
innodb_buffer_pool_size = 512M
innodb_log_file_size = 1024M
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit = 0
key_buffer_size = 64M
log-bin = /data/mysql/mysql-bin
binlog_format = mixed
expire_logs_days = 10
slow_query_log = 1
slow_query_log_file = /data/mysql/slow_query.log
long_query_time = 1
server-id=1
[mysqld_safe]
log-error=/data/mysql/mysql_error.log
pid-file=/data/mysql/mysql.pid
$ cp support-files/mysql.server /etc/init.d/mysqld
$ vim /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/data/mysql
$ /etc/init.d/mysqld start
Starting MySQL.Logging to ‘/data/mysql/mysql_error.log‘.
SUCCESS!
使用初始化密码登录
$ mysql -uroot -p
>set password=password("oldboy123");
>exit # 退出使用新密码登录
标签:png default login comm storage top unicode 生成 vim
原文地址:https://www.cnblogs.com/centlnx/p/12709984.html