标签:log-error 初始化 shared openssl 初始 dir wal use ide
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libaio-devel-0.3.109-13.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libaio-0.3.109-13.el7.x86_64.rpm
wget https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.7/mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz
#yum -y install numactl ##error while loading shared libraries: libnuma.so.1
#yum -y install openssl ##[ERROR] Could not find OpenSSL on the system
rpm -ivh libaio-0.3.109-13.el7.x86_64.rpm
rpm -ivh libaio-devel-0.3.109-13.el7.x86_64.rpm
tar -xzvf mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz
mv ./mysql-5.7.25-linux-glibc2.12-x86_64 /usr/local/mysqlrun
groupadd mysql
useradd -M -g mysql -s /sbin/nologin mysql
mkdir -p /usr/local/mysqldata/data
mkdir -p /usr/local/mysqldata/binlogs
mkdir -p /usr/local/mysqldata/relaylogs
touch /usr/local/mysqldata/mysql-error.log
chown -R mysql:mysql /usr/local/mysqldata
chmod -R 770 /usr/local/mysqldata
chown -R mysql:mysql /usr/local/mysqlrun
chmod -R 770 /usr/local/mysqlrun
mv /etc/my.cnf /etc/my.cnf_bak`date "+%Y%m%d%H%M"`
cat << EOF > /etc/my.cnf
[mysqld]
user=mysql
port=3306
#server-id=1
#binlog_format = ROW
#max_binlog_size = 1G
#expire_logs_days = 7
#log-bin=/usr/local/mysqldata/binlogs/mysql-bin
#relay-log=/usr/local/mysqldata/relaylogs/slave-relay-bin
skip-grant-tables
log-error=/usr/local/mysqldata/mysql-error.log
datadir=/usr/local/mysqldata/data
basedir=/usr/local/mysqlrun
socket=/usr/local/mysqlrun/mysql.sock
pid-file=/usr/local/mysqlrun/mysql.pid
skip-name-resolve
symbolic-links = 0
lower_case_table_names = 1
character-set-server = utf8
default-storage-engine = InnoDB
innodb_file_per_table = 1
max_connections = 2000
max_allowed_packet = 1G
interactive_timeout = 120
wait_timeout = 864000
[mysql]
socket=/usr/local/mysqlrun/mysql.sock
EOF
/usr/local/mysqlrun/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysqlrun --datadir=/usr/local/mysqldata/data
/usr/local/mysqlrun/bin/mysql_ssl_rsa_setup --datadir=/usr/local/mysqldata/data
sed -i ‘/^basedir/c\basedir=\/usr\/local\/mysqlrun‘ /usr/local/mysqlrun/support-files/mysql.server
sed -i ‘/^datadir/c\datadir=\/usr\/local\/mysqldata\/data‘ /usr/local/mysqlrun/support-files/mysql.server
echo ‘export PATH=/usr/local/mysqlrun/bin:$PATH‘ >> /etc/profile
source /etc/profile
ln -s /usr/local/mysqlrun/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
chkconfig --list
systemctl enable mysqld
systemctl restart mysqld && systemctl status mysqld
#/usr/local/mysqlrun/bin/mysqld_safe --defaults-file=/etc/my.cnf &
#ps -ef | grep mysql | grep -v grep | awk ‘{print $2}‘ |xargs kill -9
ROOT_PASSWD=‘m4r!adbOP‘
ROOT_PASSWD_T=‘m4r\!adbOP‘
mysql -uroot -e "update mysql.user set authentication_string=password(‘${ROOT_PASSWD_T}‘) where user=‘root‘;"
mysql -uroot -e "flush privileges;"
sed -i ‘s/^skip-grant-tables/#&/‘ /etc/my.cnf
mysql --connect-expired-password -uroot -p"${ROOT_PASSWD}" -e "ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘${ROOT_PASSWD_T}‘;"
mysql --connect-expired-password -uroot -p"${ROOT_PASSWD}" -e "flush privileges;"
mysql -uroot -p"${ROOT_PASSWD}" -e "show databases;"
mysql -uroot -p"${ROOT_PASSWD}" -e "update mysql.user set host=‘%‘ where user=‘root‘ and host=‘localhost‘;"
mysql -uroot -p"${ROOT_PASSWD}" -e "select user,host from mysql.user;"
firewall-cmd --permanent --zone=public --add-port=3306/tcp
firewall-cmd --reload
标签:log-error 初始化 shared openssl 初始 dir wal use ide
原文地址:https://www.cnblogs.com/jipinglong/p/11206609.html