CentOS6+MySQL5.6二进制安装

一般我们安装mysql采用二进制安装的方式就足以满足我们的生产环境了,不过需要我们配置my.cnf文件

[[email protected] ~]#tar xvf mysql-5.6.16-linux-glibc2.5-x86_64.tar.gz

mv mysql-5.6.16-linux-glibc2.5-x86_64 /usr/local/mysql

[[email protected]]#groupadd mysql -g 512
[[email protected]]#useradd-u 512 -g mysql -s /sbin/nologin -d /home/mysql mysql
[[email protected]]#mkdir-p /data/mysql
[[email protected]]#mkdir-p /log/mysql
[[email protected]]#chown-R mysql:mysql /data/mysql
[[email protected]]#chown -R mysql:mysql/usr/local/mysql
[[email protected]]#chown-R mysql:mysql /log
[[email protected]]#echo "export PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/lib">>/etc/profile
[[email protected]]#source /etc/profile

[[email protected]~]# cat /etc/my.cnf

[client]
#port        =3306
#socket        =/tmp/mysql.sock
#default-character-set=utf8
 
[mysql]
#default-character-set=utf8
 
[mysqld]
port        =3306
socket        =/tmp/mysql.sock
basedir        =/usr/local/mysql
datadir        =/data/mysql
open_files_limit    = 3072
back_log= 103
max_connections= 512
max_connect_errors= 100000
table_open_cache= 512
external-locking= FALSE
max_allowed_packet= 32M
sort_buffer_size= 2M
join_buffer_size= 2M
thread_cache_size= 51
query_cache_size= 32M
tmp_table_size= 96M
max_heap_table_size= 96M
slow_query_log= 1
slow_query_log_file= /data/mysql/slow.log
log-error= /data/mysql/error.log
long_query_time= 0.05
server-id= 1
log-bin =/data/mysql/mysql-bin
sync_binlog= 1
binlog_cache_size= 4M
max_binlog_cache_size= 8M
max_binlog_size= 1024M
expire_logs_days= 7
key_buffer_size= 32M
read_buffer_size= 1M
read_rnd_buffer_size= 16M
bulk_insert_buffer_size= 64M
character-set-server=utf8
default-storage-engine= InnoDB
binlog_format=row
 
#gtid_mode=on
#log_slave_updates=1
#enforce_gtid_consistency=1
 
transaction_isolation= REPEATABLE-READ
innodb_additional_mem_pool_size= 16M
innodb_buffer_pool_size= 1434M
innodb_data_file_path= ibdata1:1024M:autoextend
innodb_flush_log_at_trx_commit= 1
innodb_log_buffer_size= 16M
innodb_log_file_size= 256M
innodb_log_files_in_group= 2
innodb_max_dirty_pages_pct= 50
innodb_file_per_table= 1
innodb_locks_unsafe_for_binlog= 0
[mysqldump]
quick
max_allowed_packet= 32M

[[email protected]]# ./mysql_install_db --basedir=/usr/local/mysql --datadir=/data/mysql--defaults-file=/etc/my.cnf --user=mysql

8.进到bin下./mysqld_safe--help看下

[[email protected]]# ./mysqld_safe --defaults-file=/etc/my.cnf &

mysql>delete from mysql.user where user!=‘root‘ or host!=‘localhost‘;
Query OK,5 rows affected (0.01 sec)
 
mysql>update user set password=password(‘root123‘) where user=‘root‘;
Query OK,1 row affected (0.00 sec)
mysql>grant select,delete,update,insert on *.* to [email protected]‘192.168.1.%‘ identified by ‘root123‘;
Query OK,0 rows affected (0.00 sec)
mysql>grant all privileges on *.* to [email protected]‘192.168.1.%‘ identified by ‘root123‘;
Query OK,0 rows affected (0.28 sec)
mysql>flush privileges;
Query OK,0 rows affected (0.00 sec)

mysql>select user,host,password from mysql.user;

+-------+-------------+-------------------------------------------+

|user  | host        | password                                  |

+-------+-------------+-------------------------------------------+

|root  | localhost   | *A9F635AE07EC0944EFFE52FD0A86327B98ADDED7|

|root  | 192.168.1.% |*A9F635AE07EC0944EFFE52FD0A86327B98ADDED7 |

| helei |192.168.1.% | *A9F635AE07EC0944EFFE52FD0A86327B98ADDED7 |

+-------+-------------+-------------------------------------------+

3 rows inset (0.00 sec)

[[email protected]]# ./mysqladmin -uroot -p shutdown

Enterpassword:

16031700:53:52 mysqld_safe mysqld from pid file /data/mysql/HE1.pid ended

[1]+  Done                    ./mysqld_safe--defaults-file=/etc/my.cnf

配置mysql

[[email protected]]# cp support-files/mysql.server /etc/init.d/mysqld

chmod700 /etc/init.d/mysqld

chkconfig --add mysqld

chkconfig--level 2345 mysqld on

[[email protected]~]# /etc/init.d/mysqld status

ERROR! MySQL is not running

[[email protected]~]# /etc/init.d/mysqld start

StartingMySQL.. SUCCESS!

TCP和套接字连接方式

[[email protected] bin]#mysql -p -S /data/mysql.sock

Enter password:

Welcome to the MySQLmonitor.  Commands end with ; or \g.

Your MySQLconnection id is 6

Server version:5.6.16-log MySQL Community Server (GPL)

Copyright (c) 2000,2014, Oracle and/or its affiliates. All rights reserved.

Oracle is aregistered trademark of Oracle Corporation and/or its

affiliates. Othernames may be trademarks of their respective

owners.

Type ‘help;‘ or ‘\h‘for help. Type ‘\c‘ to clear the current input statement.

mysql> quit

Bye

[[email protected]~]# /etc/init.d/mysqld stop

Shuttingdown MySQL.. SUCCESS!

[[email protected]~]# /etc/init.d/mysqld status

ERROR! MySQL is not running

时间: 2024-08-26 00:30:57

CentOS6+MySQL5.6二进制安装的相关文章

mysql5.6二进制安装

mysql服务器安装在linux居多,网上有很多种方法,本人推荐用用二进制.理由如下: 1,二进制安装安装方便. 2,oralce制定的在二进制包优化方面也是很优秀的,而大多数dba对GCC编译了解也不是很深,编译源码并不一定会比二进制好. 3,二进制有一定的对比性方便排查问题,源码添加的模块不同不好参考. =================二进制安装mysql 系统:CentOS 6 x86_64 下载MySQL mkdir /soft  cd /soft && wget  解压MySQ

mysql5.7二进制安装

介绍系统 rhel7.2-64安装方式 二进制MySQL 5.7高可用架构 主主备份方式 xtrabackup注意:其中1节点为生产环境,需要将现有数据xtrabackup,并在2号节点恢复,然后进行主主搭建,在2节点上进行change master 时候需要查看1节点的备份点,从这个备份点慢慢的追平.master1>cat Xtrabackup_binlog_info步骤上传安装包mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz创建用户Groupadd my

mysql5.18二进制安装

下载mysqld二进制包 [[email protected] ~]# wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz --2020-03-01 20:44:21-- https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz

ubuntu mysql5.6二进制安装

200 ? "200px" : this.width)!important;} --> 介绍 以前一直使用centos今天需要对一台ubantu的系统安装mysql,虽然它也是类unix但是和redhat或centos命令上还是有点差别. 下载解压 wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz mv mysql-5.6.33-linux-gli

轻松使用二进制安装Mysql5.6

二进制安装mysql5.6 系统环境:Centos6.5 x86_64 mysql二进制包:mysql-5.6.29-linux-glibc2.5-x86_64.tar.gz #解压tar包到指定安装目录: cp mysql-5.6.29-linux-glibc2.5-x86_64.tar.gz /data/ tar -zxf /data/mysql-5.6.29-linux-glibc2.5-x86_64.tar.gz #创建mysql数据存储目录 mkdir /data/mysqldata

CentOs6.5系统下MySQL-5.7.19安装

好长时间没有更新了,今天给大家分享一波简单的文档,菜鸟的入门精神就是不断的学习,不断地找大神帮助!!!! 在这里今天给大家推荐一个博文地址:http://sumongodb.blog.51cto.com/ 好了!废话少说,干活走起来!!!!!!!! CentOs6.5下mysql5.7.19二进制安装是我自己编译的官方源码包 首先我们把一些依赖包安装上: yum -y groupinstall "Development tools" yum -y install ncurses ncu

CentOS6.5上编译安装MySQL-5.5.38

MySQL通常有三种安装方式: RPM包 以及 yum 安装 通用二进制包安装 源码编译安装 这里, 我们仅对源码编译安装进行讲解.首先需要说明的是从MySQL5.5开始就要用cmake安装了,已不能用./configure编译安装,所以我们首先需要安装cmake. 1.安装必要的编译环境 # yum -y install  gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* lib

mysql5.6 通用二进制安装

mysql5.6 通用二进制安装: #卸载原有的mysqlyum remove mysql*ls /etc/my.cnf*mv /etc/my.cnf* /tmp/ #安装依赖包yum install make cmake gcc gcc-c++ bison-devel ncurses-devel autoconf automake -y #添加用户groupadd mysqluseradd -r -g mysql mysql#useradd -M -s /sbin/nologin mysql

二进制安装MySQL-5.5.33

二进制安装MySQL很方便,相比较编译安装,美中不足的就是安装包太大了.哈哈 开始安装,首先养成好习惯,创建一个专门存放安装包的目录 mkdir -p /home/yuci/tools 安装 lrzsz 可以在xshell下直接将安装包拖拽到指定目录下 yum -y install lrzsz 将 mysql 安装包拖拽到 /home/yuci/tools 目录下,解压就OK了 cd /home/yuci/tools/ tar zxf mysql-5.5.33-linux2.6-x86_64.t