Linux CentOS MySQL 5.7.18 5.7.X安装教程

原创 2017年04月24日 10:53:56
#安装依赖包
yum search libaio  # search for info
yum install libaio # install library
#新建用户组合用户
groupadd mysql
useradd mysql -g mysql
#解压到data下面
tar -zxvf /data/software/mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz -C /data
#重命名
mv mysql-5.7.18-linux-glibc2.5-x86_64/ mysql
#安装
cd mysql/
mkdir data
更改所有者
cd ../
chown -R mysql:mysql mysql/
#授权755
chmod -R 755 mysql/
cd mysql
./bin/mysqld --user=mysql --basedir=/data/mysql --datadir=/data/mysql/data --initialize




#注意最下面的密码
2017-04-21T02:36:14.351072Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-04-21T02:36:15.174993Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-04-21T02:36:15.331692Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-04-21T02:36:15.608132Z 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: 4ab0413b-263b-11e7-9795-8e59748c97ed.
2017-04-21T02:36:15.615879Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-04-21T02:36:15.620346Z 1 [Note] A temporary password is generated for root@localhost: o*s#gqh)F4Ck


#先简单测试一下
执行 ./support-files/mysql.server start
如果提示下面错误
./support-files/mysql.server: line 239: my_print_defaults: command not found
./support-files/mysql.server: line 259: cd: /usr/local/mysql: No such file or directory
Starting MySQL ERROR! Couldn't find MySQL server (/usr/local/mysql/bin/mysqld_safe)


那就正常了,哈哈
1.cp support-files/mysql.server  /etc/init.d/mysqld


2.chmod 755 /etc/init.d/mysqld


3.vi /etc/init.d/mysqld
将66-73行/usr/local/修改为/data/ 
修改前
then
  basedir=/usr/local/mysql
  bindir=/usr/local/mysql/bin
  if test -z "$datadir"
  then
    datadir=/usr/local/mysql/data
  fi
  sbindir=/usr/local/mysql/bin
  libexecdir=/usr/local/mysql/bin
else
修改后,根据你的实际目录修改
then
  basedir=/data/mysql
  bindir=/data/mysql/bin
  if test -z "$datadir"
  then
    datadir=/data/mysql/data
  fi
  sbindir=/data/mysql/bin
  libexecdir=/data/mysql/bin
else




service mysqld start
如果提示Starting MySQL.Logging to '/data/mysql/data/MyServer.err'.


不管它就行,以后重启就不会提示了

接下来来配置my.cnf

如果按照下面配置好配置文件还不行,

记得kill进程

ps -ef|grep mysql

kill -9 pid

先清理一下内存
sync
echo 3 > /proc/sys/vm/drop_caches


下面是my.cnf的具体配置


[client]
no-beep
socket =/data/mysql/mysql.sock
# pipe
# socket=0.0
port=3306


[mysql]


default-character-set=utf8


[mysqld]


basedir=/data/mysql
datadir=/data/mysql/data
port=3306
pid-file=/data/mysql/mysqld.pid
#skip-grant-tables
skip-name-resolve
socket = /data/mysql/mysql.sock
character-set-server=utf8
default-storage-engine=INNODB
explicit_defaults_for_timestamp = true
# Server Id.
server-id=1
max_connections=2000




query_cache_size=0




table_open_cache=2000




tmp_table_size=246M


thread_cache_size=300
#限定用于每个数据库线程的栈大小。默认设置足以满足大多数应用
thread_stack = 192k
key_buffer_size=512M


read_buffer_size=4M
read_rnd_buffer_size=32M
innodb_data_home_dir = /data/mysql/data
innodb_flush_log_at_trx_commit=0


innodb_log_buffer_size=16M


innodb_buffer_pool_size=256M


innodb_log_file_size=128M


innodb_thread_concurrency=128


innodb_autoextend_increment=1000


innodb_buffer_pool_instances=8


innodb_concurrency_tickets=5000


innodb_old_blocks_time=1000


innodb_open_files=300


innodb_stats_on_metadata=0


innodb_file_per_table=1


innodb_checksum_algorithm=0
back_log=80


flush_time=0


join_buffer_size=128M


max_allowed_packet=1024M


max_connect_errors=2000


open_files_limit=4161


query_cache_type=0


sort_buffer_size=32M


table_definition_cache=1400


binlog_row_event_max_size=8K


sync_master_info=10000


sync_relay_log=10000


sync_relay_log_info=10000
#批量插入数据缓存大小,可以有效提高插入效率,默认为8M
bulk_insert_buffer_size = 64M


interactive_timeout = 120
wait_timeout = 120
log-bin-trust-function-creators=1
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 




修改密码
/data/mysql/bin/mysql -uroot -p
密码初装的时候有
SET PASSWORD = PASSWORD('mima123');
grant all privileges on *.* to root@'%' identified by 'mima123';
flush privileges;

相关文章推荐

CENTOS7使用rpm方式安装mysql5.7.18

1、# yum install libaio //mysql依赖包 2、# rpm -ivh mysql-community-libs-5.7.17-1.el6.x86_64.rpm  mysql-c...

linux上安装免安装版MySQL5.7.18小记

linux上安装免安装版MySQL5.7.18小记1. 下载mysql-generic点我进入下载页面2. 安装2.1 创建mysql的group跟usershell>groupadd mysql s...

Linux下安装Mysql5.7.18

当初真是手贱 安装这个mysql5.7.18版本.网上的教程大多数都是5.7以前的,而且即使有5.7版本的要么图炸了要么有其他的问题,以下是我整理的 1.添加mysql组和mysql用户,用于...

CentOS7下安装mysql-5.7.18

本文参考了: http://blog.csdn.net/peng314899581/article/details/70241976 http://www.cnblogs.com/pythonal/p...

CentOS 7安装MySQL 5.7.18

1. MySQL下载地址,因为我用的CentOS 7,所以 我这里下载的是mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar 2. 解压 3. 安装顺序rp...

[Mysql启动报错]/etc/init.d/mysqld: line 256: my_print_defaults: command not found

启动Mysql时报错: [root@mysql]# service mysqld status /etc/init.d/mysqld: line 256: my_print_defaults: c...
  • b222007
  • b222007
  • 2013年11月18日 14:02
  • 6319

CentOS6.5下安装mysql-5.7.18-linux-glibc2.5-x86_64

CentOS6.5下安装Mysql5.7.18

CentOS 6.5/6.6 yum安装mysql 5.7 最完整版教程

Step1: 检测系统是否自带安装mysql #yum list installed | grep mysql Step2: 删除系统自带的mysql及其依赖 命令: # yum -y remov...

linux上安装免安装版MySQL5.7.18

1. 下载mysql 从官网下载mysql的压缩包    mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz 2 把下载的包上传到linux上,先安装下依赖包:U...

mysql5.7.18+linux安装二进制包与运行

mysql5.7.18
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Linux CentOS MySQL 5.7.18 5.7.X安装教程
举报原因:
原因补充:

(最多只允许输入30个字)