Zabbix4.X (d) of the compiler installation mysql5.6.45

1. Download Source mysql to / usr / local / src
command:
cd / usr / local / src
wget https://downloads.mysql.com/archives/get/file/mysql-5.6.44.tar.gz
Zabbix4.X (d) of the compiler installation mysql5.6.45

2. Unzip mysql-5.6.45
command:
tar XF mysql-5.6.45-Linux-glibc2.12-x86_64.tar.gz
Zabbix4.X (d) of the compiler installation mysql5.6.45

3. Create a mysql user
command:
useradd -s / sbin / nologin mysql
Zabbix4.X (d) of the compiler installation mysql5.6.45

4.进入mysql-5.6.45目录,预编译mysql
命令:
cd mysql-5.6.44
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=all -DWITH_DEBUG=0 -DWITH_SSL=yes -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1
Zabbix4.X (d) of the compiler installation mysql5.6.45

5. Installation mysql
command:
the make the make the install &&
Zabbix4.X (d) of the compiler installation mysql5.6.45

6. Copy mysql.server installation directory to the lower directory and renamed /etc/init.d/ mysqld
command:
CP-Support Files / mysql.server /etc/init.d/mysqld
Zabbix4.X (d) of the compiler installation mysql5.6.45

7. /etc/init.d/mysqld add execute permissions
command:
chmod + A the X-/etc/init.d/mysqld
Zabbix4.X (d) of the compiler installation mysql5.6.45

8. Set environment variables mysql
command:
VI /etc/profile.d/mysql.sh
Export the PATH = $ the PATH: / usr / local / mysql / bin /
Zabbix4.X (d) of the compiler installation mysql5.6.45

9. allowed environment variables to take effect immediately
command:
Source /etc/profile.d/mysql.sh
Zabbix4.X (d) of the compiler installation mysql5.6.45

10.编辑mysql的配置文件my.cnf
命令:
vi /etc/my.cnf
[mysqld]
bind-address=0.0.0.0
port=3306
datadir=/data/mysql
user=mysql
skip-name-resolve
long_query_time=2
slow_query_log_file=/data/mysql/mysql-slow.log
expire_logs_days=2
innodb-file-per-table=1
innodb_flush_log_at_trx_commit = 2
log_warnings = 1
max_allowed_packet = 512M
connect_timeout = 60
net_read_timeout = 120

[mysqld_safe]
log-error=/data/mysql/mysqld.log
pid-file=/data/mysql/mysqld.pid
Zabbix4.X (d) of the compiler installation mysql5.6.45

11.创建存放mysql数据库文件的目录并给mysql目录和数据库文件目录授权
命令:
mkdir -pv /data/mysql
chown -R mysql:mysql /usr/local/mysql /data/mysql/
Zabbix4.X (d) of the compiler installation mysql5.6.45

12.安装perl-Module-Install
命令:
yum -y install perl-Module-Install
Zabbix4.X (d) of the compiler installation mysql5.6.45

13.初始化mysql数据库
命令:
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --user=mysql --datadir=/data/mysql/
Zabbix4.X (d) of the compiler installation mysql5.6.45

14.为mysql提供systemctl启动脚本
命令:
vi /usr/lib/systemd/system/mysql.service
[Unit]
Description=mysqld
After=network.target
[Service]
Type=forking
ExecStart=/etc/init.d/mysqld start
[Install]
WantedBy=multi-user.target
Zabbix4.X (d) of the compiler installation mysql5.6.45

15.启动mysql服务并开启开机自启
命令:
systemctl start mysql
systemctl enable mysql
Zabbix4.X (d) of the compiler installation mysql5.6.45

16.查看mysql进程
命令:
ps aux | grep mysql
Zabbix4.X (d) of the compiler installation mysql5.6.45

17.设置root的密码,安全性设置
命令:
mysql_secure_installation
Zabbix4.X (d) of the compiler installation mysql5.6.45
Zabbix4.X (d) of the compiler installation mysql5.6.45

18.mysql authorize an ip login
command:
MySQL -uroot--pa123456
the GRANT ALL PRIVILEGES the ON . The TO 'root'@'192.168.237.%' the IDENTIFIED BY 'zabbixpwd' the WITH the GRANT the OPTION;
the flush privileges;
Exit
Zabbix4.X (d) of the compiler installation mysql5.6.45

Guess you like

Origin blog.51cto.com/7309656/2425211