MysqL5.7主要特性:
1—更好的性能:对于多核cpu、固态硬盘、锁有着更好的优化,每秒100W QPS已不再是MysqL的追求,下个版本能否上200W QPS才是吾等用户更关心的
2—更好的InnoDB存储引擎
3—更为健壮的复制功能:复制带来了数据完全不丢失的方案,传统金融客户也可以选择使用MysqL数据库。此外,GTID在线平滑升级也变得可能
4—更好的优化器:优化器代码重构的意义将在这个版本及以后的版本中带来巨大的改进,Oracle官方正在解决MysqL之前最大的难题
5—原生JSON类型的支持
6—更好的地理信息服务支持:InnoDB原生支持地理位置类型,支持GeoJSON,GeoHash特性
7—新增sys库:以后这会是DBA访问最频繁的库
##安装依赖包 yum -y install gcc gcc-c++ ncurses ncurses-devel cmake ##下载相应源码包 cd /home/quant_group/MysqL #cd /your/download/path wget http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz wget http://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.11.tar.gz
文件目录创建
##添加MysqL用户 useradd -M -s /sbin/nologin MysqL ##预编译 tar xzf boost_1_59_0.tar.gz tar xzf MysqL-5.7.11.tar.gz cd MysqL-5.7.11 cmake -DCMAKE_INSTALL_PREFIX=/home/quant_group/MysqL/3306
-DMysqL_DATADIR=/home/quant_group/MysqL/3306/data
-DWITH_BOOST=/home/quant_group/MysqL/boost_1_59_0
-DSYSCONFDIR=/home/quant_group/MysqL
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_PARTITION_STORAGE_ENGINE=1
-DWITH_FEDERATED_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
-DWITH_MYISAM_STORAGE_ENGINE=1
-DENABLED_LOCAL_INFILE=1
-DENABLE_DTRACE=0
-DDEFAULT_CHARSET=utf8mb4
-DDEFAULT_COLLATION=utf8mb4_general_ci
-DWITH_EMBEDDED_SERVER=1 ##编译安装 make make install ##启动脚本,设置开机自启动 /bin/cp /home/quant_group/MysqL/3306/support-files/MysqL.server /etc/init.d/MysqLd chmod +x /etc/init.d/MysqLd chkconfig --add MysqLd chkconfig MysqLd on ##/etc/my.cnf,仅供参考 [MysqLd] basedir = /home/quant_group/MysqL/3306 datadir = /home/quant_group/MysqL/3306/data tmpdir = /home/quant_group/MysqL/3306/tmp pid-file = /home/quant_group/MysqL/3306/data/my.pid port = 3306
- default_storage_engine = InnoDB
- innodb_autoinc_lock_mode = 2
- explicit_defaults_for_timestamp = true
- character-set-client-handshake = FALSE
- character_set_server = utf8
- skip-name-resolve
- max_connect_errors = 1000000
- max_allowed_packet = 1G
- connect_timeout = 3600
- wait_timeout = 3600
- interactive_timeout = 3600
- innodb_lock_wait_timeout = 10
- slave-skip-errors = 1032,1062
- log-error = /home/quant_group/MysqL/3306/log/error.log
- slow_query_log = on
- slow_query_log_file = /home/quant_group/MysqL/3306/log/slow-query-log.log
- long_query_time = 1
- log-queries-not-using-indexes
- log-slow-admin-statements
- log-slow-slave-statements
- server-id = 100
- log-bin = log-bin
- binlog-format = ROW
##初始化数据库 chown -R MysqL:MysqL /home/quant_group/MysqL/3306/ cd /home/quant_group/MysqL/3306/bin ./MysqL_install_db --user=MysqL --basedir=/home/quant_group/MysqL/3306 --datadir=/home/quant_group/MysqL/3306/data ###注: 之前版本MysqL_install_db是在MysqL_basedir/script下,5.7放在了MysqL_install_db/bin目录下,且已被废弃
##启动 数据库 service MysqLd start # 启动不了可能是权限问题,把 MysqL/3306下面都赋予MysqL用户权限就好啦 ##查看 密码 view /root/.MysqL_secret ##登录 数据库 MysqL -uroot -p'.U,tH2Cf3vRj' #这边密码要加引号,要么然的话存在转义问题 如果提示 bash: MysqL: command not found 那么vim /root/.bash_profile 将MysqL 的命令加进去 比如: # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs # PATH=$PATH:$HOME/bin #修改前 PATH=$PATH:$HOME/bin:/usr/local/MysqL/bin #修改后 export PATH 然后 source /root/.bash_profile
##如何删除数据库 yum remove MysqL MysqL-server MysqL-libs MysqL-server;
创建用户
- The create user command:
- create user test identified by '123456';
- 上面建立的用户可以在任何地方登陆。
- 如果要限制在固定地址登陆,比如localhost 登陆:
- create user test@登录主机 identified by '123456';
- grant:
- grant all privileges on *.* to test@登录主机
- grant select,insert,update,delete on *.* to test@"%" Identified by "123456";
- 格式:grant select on 数据库.* to 用户名@登录主机 identified by "密码"
- 修改密码:
- grant all privileges on 数据库.* to test@登录主机 identified by '654321';
- flush:
- flush privileges;
- 查看用户信息:
- select host,user from MysqL.user;
###donation: 如有捐赠意向的朋友,请捐赠到支付宝账号:qdcccc@gmail.com 账户名:杨春炼
###ask for help: 如需帮助,请加QQ:1028750558或微信:lian-ye