[root@mysql ~]# yum -y remove mari* [root@mysql ~]# wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-boost-8.0.22.tar.gz [root@mysql ~]# tar -zxvf mysql-boost-8.0.22.tar.gz -C /usr/local/ [root@mysql ~]# cd /usr/local/mysql-8.0.22/ [root@mysql mysql-8.0.22]# groupadd mysql [root@mysql mysql-8.0.22]# useradd -r -g mysql -s /sbin/nologin mysql [root@mysql mysql-8.0.22]# mkdir -p /usr/local/mysql [root@mysql mysql-8.0.22]# mkdir -p /data/mysql/ [root@mysql mysql-8.0.22]# chown -R mysql.mysql /usr/local/mysql/ [root@mysql mysql-8.0.22]# chown -R mysql.mysql /data/mysql/ [root@mysql mysql-8.0.22]# chmod -R 755 /data/mysql/ [root@mysql mysql-8.0.22]# chmod -R 755 /usr/local/mysql/ [root@mysql mysql-8.0.22]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc -DMYSQL_TCP_PORT=3306 -DWITH_BOOST=/usr/local/mysql-8.0.22/boost -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=ON -DWITH_INNODB_MEMCACHED=ON -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DFORCE_INSOURCE_BUILD=1 [root@mysql mysql-8.0.22]# make && make install [root@mysql mysql-8.0.22]# cd bin/ [root@mysql bin]# ./mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql [root@mysql bin]# vim /etc/my.cnf [client] port=3306 socket=/tmp/mysql.sock #default-character-set=utf8 #user=root #password=123456 [mysqld] server-id=1 #skip-grant-tables port=3306 user=mysql max_connections=200 socket=/tmp/mysql.sock basedir=/usr/local/mysql datadir=/data/mysql pid-file=/data/mysql/mysql.pid init-connect='SET NAMES utf8' #character-set-server=utf8 default-storage-engine=INNODB log_error=/data/mysql/mysql-error.log slow_query_log_file=/data/mysql/mysql-slow.log [mysqldump] quick max_allowed_packet=16M [root@mysql bin]# echo "PATH=/usr/local/mysql/bin:$PATH" >> /etc/profile [root@mysql bin]# source /etc/profile [root@mysql bin]# cp /usr/local/mysql-8.0.22/support-files/mysql.server /etc/init.d/mysqld [root@mysql bin]# vim /etc/init.d/mysqld ··· basedir=/usr/local/mysql datadir=/data/mysql ··· [root@mysql bin]# chmod +x /etc/init.d/mysqld [root@mysql bin]# /etc/init.d/mysqld start [root@mysql bin]# mysql -u root -p Enterpassword: Welcome to the MySQL monitor. Commands end with ; or \g. YourMySQL connection id is 12 Serverversion: 8.0.22Source distribution
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark ofOracleCorporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type'help;' or '\h'for help. Type'\c' to clear the current input statement.
mysql>
MySQL初步搭建完成
完全备份与恢复
[root@mysql ~]# mysql -u root -p Enterpassword: Welcome to the MySQL monitor. Commands end with ; or \g. YourMySQL connection id is 15 Serverversion: 8.0.22Source distribution
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark ofOracleCorporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type'help;' or '\h'for help. Type'\c' to clear the current input statement.