centos 7 二進位制安裝mysql 5.7.25
一.安裝前系統環境檢查
1.關閉selinux
[root@mgr1 ~]# cat /etc/sysconfig/selinux # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of three values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
2.關閉 防火牆
[root@mgr1 ~]# systemctl stop firewalld [root@mgr1 ~]# systemctl status firewalld ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: inactive (dead) since Sat 2019-02-16 19:12:54 EST; 8s ago Docs: man:firewalld(1) Process: 7054 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS) Main PID: 7054 (code=exited, status=0/SUCCESS) Feb 16 08:46:31 mgr1 systemd[1]: Starting firewalld - dynamic firewall daemon... Feb 16 08:46:33 mgr1 systemd[1]: Started firewalld - dynamic firewall daemon. Feb 16 19:12:52 mgr1 systemd[1]: Stopping firewalld - dynamic firewall daemon... Feb 16 19:12:54 mgr1 systemd[1]: Stopped firewalld - dynamic firewall daemon.
3.centos 7 io排程系統是deadline模式,ssd硬碟需要改為noop模式
[root@mgr1 ~]# cat /sys/block/sda/queue/scheduler noop [deadline] cfq
4.作業系統的限制
[root@mgr1 default]# ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 3795 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 3795 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited
這裡面最重要的兩個引數是open files和max user processes
編輯/etc/security/limits.conf,加入下面的內容
* soft nproc 65535 * hard nproc 65535 * soft nofile 65535 * hard nofile 65535
5.numa
6.建立使用者組和使用者
[root@mgr1 default]# groupadd mysql [root@mgr1 default]# [root@mgr1 default]# useradd -g mysql mysql -s /sbin/nologin [root@mgr1 default]#
7.做個軟連線
[root@mgr1 default]# cd /usr/local [root@mgr1 local]# ls -ltr total 0 drwxr-xr-x. 2 root root 6 Apr 11 2018 src drwxr-xr-x. 2 root root 6 Apr 11 2018 sbin drwxr-xr-x. 2 root root 6 Apr 11 2018 libexec drwxr-xr-x. 2 root root 6 Apr 11 2018 lib64 drwxr-xr-x. 2 root root 6 Apr 11 2018 lib drwxr-xr-x. 2 root root 6 Apr 11 2018 include drwxr-xr-x. 2 root root 6 Apr 11 2018 games drwxr-xr-x. 2 root root 6 Apr 11 2018 etc drwxr-xr-x. 2 root root 6 Apr 11 2018 bin drwxr-xr-x. 5 root root 49 Feb 16 08:30 share drwxr-xr-x. 9 root root 129 Feb 16 18:58 mysql-5.7.25-linux-glibc2.12-i686 [root@mgr1 local]# ln -s mysql-5.7.25-linux-glibc2.12-i686 mysql
8.授權
[root@mgr1 local]# chown mysql:mysql -R mysql
9.建立mysql資料庫的資料目錄(datadir)
[root@mgr1 /]# mkdir -p /data/mysql
10.給資料目錄授權
[root@mgr1 /]# chown -R mysql:mysql /data/mysql
11.配置/etc/my.cnf檔案
[client] port = 3306 socket = /usr/local/mysql/mysql.sock [mysql] prompt="\u@db \R:\m:\s [\d]> " no-auto-rehash [mysqld] user=mysql port=3306 socket=/usr/local/mysql/mysql.sock server_id=20 gtid_mode=on enforce_gtid_consistency=on master_info_repository=table relay_log_info_repository=table binlog_checksum=none log_slave_updates=on log-bin=/usr/local/mysql/log/mysql-bin binlog_format=row basedir=/usr/local/mysql datadir=/data/mysql performance_schema=1 character-set-server=utf8 collation-server=utf8_bin log_timestamps=system explicit_defaults_for_timestamp=true ####group replication transaction_write_set_extraction =XXHASH64 loose-group_replication_group_name ='bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb' loose-group_replication_start_on_boot =off loose-group_replication_local_address ='192.168.44.132:33061' loose-group_replication_group_seeds ='192.168.44.132:33061,192.168.44.133:33061,192.168.44.134:33061' loose-group_replication_bootstrap_group =off
12.初始化
[root@mgr1 bin]# ./mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql/ --user=mysql --initialize
-bash: ./mysqld: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
解決辦法:
[root@mgr1 bin]# yum install glibc.i686
[root@mgr1 bin]# ./mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql/ --user=mysql --initialize
./mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
解決辦法:
yum -y install libaio.so.1
[root@mgr1 bin]# ./mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql/ --user=mysql --initialize
./mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory
yum install -y libnuma.so.1
[root@mgr1 bin]# ./mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql/ --user=mysql --initialize
./mysqld: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
yum install -y libstdc++.so.6
[root@mgr1 bin]# ./mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql/ --user=mysql --initialize
啟動:
[root@mgr1 bin]# ./mysqld_safe --defaults-file=/etc/my.cnf &
[1] 7910
[root@mgr1 bin]# 2019-02-17T07:47:24.044846Z mysqld_safe Logging to '/data/mysql/error.log'.
2019-02-17T07:47:24.109848Z mysqld_safe Starting mysqld daemon with databases from /data/mysql
2019-02-17T07:47:26.264358Z mysqld_safe mysqld from pid file /data/mysql/mgr1.pid ended
檢視初始化密碼:
[root@mgr1 bin]# cat /data/mysql/error.log |grep password
2019-02-17T03:06:47.347886-05:00 1 [Note] A temporary password is generated for root@localhost: vjxL1c_F3*fd
登入:
[root@mgr1 bin]# ./mysql -uroot -p
修改密碼:
root@db 03:10: [(none)]> set password='root123';
Query OK, 0 rows affected (0.00 sec)
root@db 03:12: [(none)]> alter user 'root'@'localhost' password expire never;
Query OK, 0 rows affected (0.00 sec)
root@db 03:13: [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
設定環境變數
export PATH=$PATH:/usr/local/mysql/bin
讓它生效
source /etc/profile
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20893244/viewspace-2636184/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- CentOS7 安裝 MySQL8.0(二進位制)CentOSMySql
- centos7搭建lnmp安裝二進位制mysql【三】CentOSLNMPMySql
- centos7二進位制方式安裝rabbitmqCentOSMQ
- MySQL 安裝指南 二進位制安裝MySql
- Mysql二進位制包安裝MySql
- CentOS6.5二進位制檔案安裝MySQL5.6.39CentOSMySql
- CentOS安裝使用二進位制方式mysql5.6筆記CentOSMySql筆記
- MySQL linux二進位制安裝MySqlLinux
- centos7環境下二進位制編譯安裝ffmpegCentOS編譯
- CentOS6.6安裝二進位制壓縮包mysql5.6CentOSMySql
- mysql安裝-----二進位制包安裝及解除安裝MySql
- 使用二進位制包來安裝MySQLMySql
- ubuntu mysql5.6二進位制安裝UbuntuMySql
- MySQL5.7 windows二進位制安裝MySqlWindows
- 二進位制方式安裝mysql 5.6.15MySql
- 基於centos7的MySQL5.7二進位制安裝包的本地升級CentOSMySql
- 基於centos7的MySQL8.0二進位制安裝包的本地升級CentOSMySql
- Mysql for Linux安裝配置之——二進位制安裝MySqlLinux
- Percona MySQL 5.7 Linux通用二進位制包安裝(CentOS 6.5)MySqlLinuxCentOS
- Percona MySQL 5.5 Linux通用二進位制包安裝(CentOS 6.9)MySqlLinuxCentOS
- 基於centos7的MySQL5.7二進位制安裝包的邏輯升級CentOSMySql
- 基於centos7的MySQL8.0二進位制安裝包的邏輯升級CentOSMySql
- RHEL 7.2 安裝二進位制MySQL 5.7.18MySql
- yum安裝nginx-php-mysql二進位制NginxPHPMySql
- MySQL5.7 linux二進位制安裝MySqlLinux
- (OEL 6.3) Mysql6.5二進位制安裝MySql
- Ubuntu 24.04 二進位制安裝 MySQL 8.0.20UbuntuMySql
- mysql5.7 for windows二進位制安裝及配置MySqlWindows
- PostgreSQL二進位制安裝流程SQL
- mysql教程CentOS7 64位安裝MySqlCentOS
- Windows11二進位制方式安裝MySQL5.7.44WindowsMySql
- Ubuntu24 二進位制包安裝mysql5.7UbuntuMySql
- 二進位制檔案安裝安裝etcd
- MySQL 5.7 原始碼安裝、Yum倉庫安裝、RPM安裝、二進位制安裝MySql原始碼
- mysql二進位制包安裝與配置實戰記錄MySql
- CentOS 7安裝MySQLCentOSMySql
- CentOS 7 安裝 MySQLCentOSMySql
- PostgreSQL 10.23 二進位制安裝SQL