Mysql二進位制包安裝
安裝環境
OS:RHEL 6.5_X64
Mysql:mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz
1、確認是否已經安裝了依賴包
[root@dbrac16 ~]# yum info libaio | grep -A 1 Installed
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Installed Packages
Name : libaio
2、建立使用者和組
[root@dbrac16 ~]# groupadd mysql
[root@dbrac16 ~]# useradd -r -g mysql -s /bin/false mysql
3、解壓安裝包並修改許可權
[root@dbrac16 ~]# cd /usr/local/
[root@dbrac16 local]# tar -xvzf /root/mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz
[root@dbrac16 local]# mv mysql-5.7.16-linux-glibc2.5-x86_64/ mysql
[root@dbrac16 local]# cd mysql/
[root@dbrac16 mysql]# mkdir mysql-files data
[root@dbrac16 mysql]# chown -R mysql:mysql .
4、修改配置檔案
[root@dbrac16 mysql]# vim /etc/my.cnf
[mysqld]
datadir=/usr/local/mysql/data
socket=/usr/local/mysql/mysql.sock
user=mysql
symbolic-links=0
character-set-server=utf8
slow-query-log
long_query_time=3
log-output=TABLE
expire_logs_days = 7
event_scheduler=1
innodb_file_per_table=1
innodb_log_file_size=536870912
innodb_buffer_pool_size=1073741824
max_binlog_size=1073741824
log_bin_trust_function_creators=1
innodb_stats_on_metadata=0
max_connect_errors = 1000000
max_connections = 5000
skip_name_resolve = 1
explicit_defaults_for_timestamp=true
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/usr/local/mysql/my.pid
[client]
socket=/usr/local/mysql/mysql.sock
[mysql]
prompt=(\u@\h)[\d]\_
5、初始化
[root@dbrac16 mysql]# bin/mysqld --initialize --user=mysql
100 200 300 400 500
100 200 300 400 500
2017-05-10T06:45:22.857917Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-05-10T06:45:22.979376Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-05-10T06:45:23.050120Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 3de828ce-354c-11e7-9f0b-0050568a4cf6.
2017-05-10T06:45:23.052326Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-05-10T06:45:23.055440Z 1 [Note] A temporary password is generated for root@localhost: i*JRv8dBo,dO
2017-05-10T06:45:24.359775Z 1 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2017-05-10T06:45:24.359823Z 1 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2017-05-10T06:45:24.359844Z 1 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2017-05-10T06:45:24.359861Z 1 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2017-05-10T06:45:24.360360Z 1 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
[root@dbrac16 mysql]# bin/mysql_ssl_rsa_setup
Generating a 2048 bit RSA private key
...................+++
................................+++
writing new private key to 'ca-key.pem'
-----
Generating a 2048 bit RSA private key
................................................................................................................................................+++
..............................+++
writing new private key to 'server-key.pem'
-----
Generating a 2048 bit RSA private key
.........+++
..........................+++
writing new private key to 'client-key.pem'
-----
6、配置服務
[root@dbrac16 mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[root@dbrac16 mysql]# chkconfig --add mysqld
[root@dbrac16 mysql]# chkconfig --list mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@dbrac16 mysql]# /etc/init.d/mysqld start
Starting MySQL. SUCCESS!
[root@dbrac16 mysql]# echo 'export PATH=/usr/local/mysql/bin:$PATH' >>/etc/profile
[root@dbrac16 mysql]# source /etc/profile
7、修改密碼
[root@dbrac16 mysql]# mysql -u root -p
Enter password: i*JRv8dBo,dO
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.16
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation 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.
(root@localhost)[(none)] SET PASSWORD = PASSWORD('123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)
(root@localhost)[(none)] flush privileges;
Query OK, 0 rows affected (0.00 sec)
(root@localhost)[(none)] use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
(root@localhost)[mysql] update user set host = '%' where user = 'root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
(root@localhost)[mysql] flush privileges;
Query OK, 0 rows affected (0.00 sec)
[root@dbrac16 mysql]# /etc/init.d/mysqld restart
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!
8、檢視執行情況
[root@dbrac16 mysql]# netstat -tunlp | grep 3306
tcp 0 0 :::3306 :::* LISTEN 28493/mysqld
[root@dbrac16 mysql]# ps -ef | grep mysql | grep -v grep
root 28321 1 0 12:04 pts/0 00:00:00 /bin/sh /opt/data/mysql/bin/mysqld_safe --datadir=/opt/data/mysql/data --pid-file=/opt/data/mysql/data/dbrac16.pid
mysql 28493 28321 0 12:04 pts/0 00:00:00 /opt/data/mysql/bin/mysqld --basedir=/opt/data/mysql --datadir=/opt/data/mysql/data --plugin-dir=/opt/data/mysql/lib/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/opt/data/mysql/data/dbrac16.pid --socket=/opt/data/mysql/mysql.sock
OS:RHEL 6.5_X64
Mysql:mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz
1、確認是否已經安裝了依賴包
[root@dbrac16 ~]# yum info libaio | grep -A 1 Installed
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Installed Packages
Name : libaio
2、建立使用者和組
[root@dbrac16 ~]# groupadd mysql
[root@dbrac16 ~]# useradd -r -g mysql -s /bin/false mysql
3、解壓安裝包並修改許可權
[root@dbrac16 ~]# cd /usr/local/
[root@dbrac16 local]# tar -xvzf /root/mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz
[root@dbrac16 local]# mv mysql-5.7.16-linux-glibc2.5-x86_64/ mysql
[root@dbrac16 local]# cd mysql/
[root@dbrac16 mysql]# mkdir mysql-files data
[root@dbrac16 mysql]# chown -R mysql:mysql .
4、修改配置檔案
[root@dbrac16 mysql]# vim /etc/my.cnf
[mysqld]
datadir=/usr/local/mysql/data
socket=/usr/local/mysql/mysql.sock
user=mysql
symbolic-links=0
character-set-server=utf8
slow-query-log
long_query_time=3
log-output=TABLE
expire_logs_days = 7
event_scheduler=1
innodb_file_per_table=1
innodb_log_file_size=536870912
innodb_buffer_pool_size=1073741824
max_binlog_size=1073741824
log_bin_trust_function_creators=1
innodb_stats_on_metadata=0
max_connect_errors = 1000000
max_connections = 5000
skip_name_resolve = 1
explicit_defaults_for_timestamp=true
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/usr/local/mysql/my.pid
[client]
socket=/usr/local/mysql/mysql.sock
[mysql]
prompt=(\u@\h)[\d]\_
5、初始化
[root@dbrac16 mysql]# bin/mysqld --initialize --user=mysql
100 200 300 400 500
100 200 300 400 500
2017-05-10T06:45:22.857917Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-05-10T06:45:22.979376Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-05-10T06:45:23.050120Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 3de828ce-354c-11e7-9f0b-0050568a4cf6.
2017-05-10T06:45:23.052326Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-05-10T06:45:23.055440Z 1 [Note] A temporary password is generated for root@localhost: i*JRv8dBo,dO
2017-05-10T06:45:24.359775Z 1 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2017-05-10T06:45:24.359823Z 1 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2017-05-10T06:45:24.359844Z 1 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2017-05-10T06:45:24.359861Z 1 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2017-05-10T06:45:24.360360Z 1 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
[root@dbrac16 mysql]# bin/mysql_ssl_rsa_setup
Generating a 2048 bit RSA private key
...................+++
................................+++
writing new private key to 'ca-key.pem'
-----
Generating a 2048 bit RSA private key
................................................................................................................................................+++
..............................+++
writing new private key to 'server-key.pem'
-----
Generating a 2048 bit RSA private key
.........+++
..........................+++
writing new private key to 'client-key.pem'
-----
6、配置服務
[root@dbrac16 mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[root@dbrac16 mysql]# chkconfig --add mysqld
[root@dbrac16 mysql]# chkconfig --list mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@dbrac16 mysql]# /etc/init.d/mysqld start
Starting MySQL. SUCCESS!
[root@dbrac16 mysql]# echo 'export PATH=/usr/local/mysql/bin:$PATH' >>/etc/profile
[root@dbrac16 mysql]# source /etc/profile
7、修改密碼
[root@dbrac16 mysql]# mysql -u root -p
Enter password: i*JRv8dBo,dO
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.16
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation 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.
(root@localhost)[(none)] SET PASSWORD = PASSWORD('123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)
(root@localhost)[(none)] flush privileges;
Query OK, 0 rows affected (0.00 sec)
(root@localhost)[(none)] use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
(root@localhost)[mysql] update user set host = '%' where user = 'root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
(root@localhost)[mysql] flush privileges;
Query OK, 0 rows affected (0.00 sec)
[root@dbrac16 mysql]# /etc/init.d/mysqld restart
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!
8、檢視執行情況
[root@dbrac16 mysql]# netstat -tunlp | grep 3306
tcp 0 0 :::3306 :::* LISTEN 28493/mysqld
[root@dbrac16 mysql]# ps -ef | grep mysql | grep -v grep
root 28321 1 0 12:04 pts/0 00:00:00 /bin/sh /opt/data/mysql/bin/mysqld_safe --datadir=/opt/data/mysql/data --pid-file=/opt/data/mysql/data/dbrac16.pid
mysql 28493 28321 0 12:04 pts/0 00:00:00 /opt/data/mysql/bin/mysqld --basedir=/opt/data/mysql --datadir=/opt/data/mysql/data --plugin-dir=/opt/data/mysql/lib/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/opt/data/mysql/data/dbrac16.pid --socket=/opt/data/mysql/mysql.sock
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28536251/viewspace-2138854/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 使用二進位制包來安裝MySQLMySql
- mysql安裝-----二進位制包安裝及解除安裝MySql
- MySQL 安裝指南 二進位制安裝MySql
- Ubuntu24 二進位制包安裝mysql5.7UbuntuMySql
- MySQL linux二進位制安裝MySqlLinux
- mysql二進位制包安裝與配置實戰記錄MySql
- 03二進位制包安裝與介紹
- CentOS6.6安裝二進位制壓縮包mysql5.6CentOSMySql
- Linux下解除安裝MySQL二進位制包(tar.gz)LinuxMySql
- centos 7 二進位制安裝mysql 5.7.25CentOSMySql
- ubuntu mysql5.6二進位制安裝UbuntuMySql
- MySQL5.7 windows二進位制安裝MySqlWindows
- 二進位制方式安裝mysql 5.6.15MySql
- Mysql for Linux安裝配置之——二進位制安裝MySqlLinux
- Percona MySQL 5.7 Linux通用二進位制包安裝(CentOS 6.5)MySqlLinuxCentOS
- Percona MySQL 5.5 Linux通用二進位制包安裝(CentOS 6.9)MySqlLinuxCentOS
- 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
- CentOS7 安裝 MySQL8.0(二進位制)CentOSMySql
- mysql5.7 for windows二進位制安裝及配置MySqlWindows
- PostgreSQL二進位制安裝流程SQL
- centos7搭建lnmp安裝二進位制mysql【三】CentOSLNMPMySql
- Windows11二進位制方式安裝MySQL5.7.44WindowsMySql
- 二進位制檔案安裝安裝etcd
- MySQL 5.7 原始碼安裝、Yum倉庫安裝、RPM安裝、二進位制安裝MySql原始碼
- CentOS6.5二進位制檔案安裝MySQL5.6.39CentOSMySql
- CentOS安裝使用二進位制方式mysql5.6筆記CentOSMySql筆記
- 基於centos7的MySQL5.7二進位制安裝包的本地升級CentOSMySql
- 基於centos7的MySQL8.0二進位制安裝包的本地升級CentOSMySql
- PostgreSQL 10.23 二進位制安裝SQL
- 基於Linux的MySQL5.7的二進位制安裝LinuxMySql
- 安裝編譯好的二進位制mysql並更改路徑編譯MySql
- 基於centos7的MySQL5.7二進位制安裝包的邏輯升級CentOSMySql
- 基於centos7的MySQL8.0二進位制安裝包的邏輯升級CentOSMySql
- MySQL二進位制日誌MySql