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
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。