1.下载二进制文件并解压文件:下载地址:https://dev.Mysql.com/downloads/mysql/5.7.html#downloadstar xvzf mysql-5.7.23-linux
1.下载二进制文件并解压文件:
下载地址:https://dev.Mysql.com/downloads/mysql/5.7.html#downloads
tar xvzf mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.7.23-linux-glibc2.12-x86_64 /usr/local/
cd /usr/local/
ln -s mysql-5.7.23-linux-glibc2.12-x86_64 mysql
chown -R mysql:mysql /usr/local/mysql/
vim /etc/my.cnf
######################mysql5.7.23###############
[client]
port=3306
Socket=/app/data/run/mysql.sock
[mysql]
#pid_file=/app/data/run/mysqld.pid
[mysqld]
gtid_mode=on
enforce_gtid_consistency=on
log_slave_updates=on
autocommit=1
general_log=off
explicit_defaults_for_timestamp=true
###character
default-storage-engine=INNODB
innodb_file_per_table=1
character-set-server=utf8
collation-server=utf8_general_ci
interactive_timeout = 559200
wait_timeout = 559200
# system
basedir=/usr/local/mysql
datadir=/app/data/data
max_allowed_packet=1g
max_connections=3000
max_user_connections=2800
open_files_limit=65535
pid_file=/app/data/run/mysqld.pid
port=3306
server_id=52160
#skip_name_resolve=ON
socket=/app/data/run/mysql.sock
tmpdir=/app/data/tmp
#innodb
innodb_data_home_dir=/app/data/log/iblog
innodb_log_group_home_dir=/app/data/log/iblog
innodb_buffer_pool_size = 1000M
#binlog
log_bin=/app/data/log/binlog/binlog
binlog_fORMat=row
expire_logs_days=7
innodb_log_file_size = 200M
innodb_log_files_in_group = 4
max_binlog_size=200M
#logging
log_error=/app/data/log/error.log
slow_query_log_file=/app/data/log/slow.log
log_queries_not_using_indexes=0
slow_query_log=1
log_slave_updates=ON
log_slow_admin_statements=1
long_query_time=1
#relay
relay_log=/app/data/log/relaylog
relay_log_index=/app/data/log/relay.index
relay_log_info_file=/app/data/log/relay-log.info
[mysqld_safe]
datadir=/app/data/data
################mysql5.7.23##############
--添加用户:
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
---
或者直接:
useradd mysql
cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
--创建数据目录:
mkdir -p /app/data/log
mkdir -p /app/data/log/binlog
mkdir -p /app/data/run
mkdir -p /app/data/tmp
mkdir -p /app/data/log/iblog
chown -R mysql:mysql /app/data/
--初始化数据库:
[root@test1 ~]# su - mysql
[mysql@test1 ~]$ /usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf --initialize --user=mysql
2.1 通脚本启动:
启动数据库:
[mysql@test1 log]$ /etc/init.d/mysqld start
Starting MySQL.. [ OK ]
关闭数据库:
[mysql@test1 log]$ /etc/init.d/mysqld stop
Shutting down MySQL.. [ OK ]
登录数据库:
[mysql@test1 log]$ /usr/local/mysql/bin/mysql -uroot -p
修改密码:
mysql> alter user root@'localhost' identified by 'MYsql#123';
Query OK, 0 rows affected (0.00 sec)
2.2 自定义配置文件启动:
启动数据库:
[mysql@test1 log]$ /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql &
关闭数据库:
[mysql@test1 log]$ /usr/local/mysql/bin/mysqladmin --port=3306 shutdown -p
Enter passWord:
3.开机自动启动:
[root@test1 ~]# chkconfig mysqld on
--结束END--
本文标题: mysql 二进制文件安装
本文链接: https://lsjlt.com/news/35861.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0