centos7 二进制安装包安装 MysqL5.6
一、下载MysqL5.6二进制安装包
http://mirrors.sohu.com/MysqL/mysql-5.6/
如:mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz
二、安装MysqL5.6(安装在/data/MysqL56)
(1)、创建MysqL用户账号
> useradd -s /sbin/nologin -M MysqL
(2)、解压压缩包
> tar xf mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz
(3)、重命名
> mv mysql-5.6.34-linux-glibc2.5-x86_64 MysqL56
(4)、复制配置文件
> cp /data/MysqL56/support-files/my-default.cnf /etc/my.cnf
修改配置文件
[clIEnt]port = 3306socket = /data/MysqL56/MysqL.sockdefault-character-set = utf8[MysqLd]skip-name-resolveuser = MysqLbasedir = /data/MysqL56datadir = /data/MysqL56/dataport = 3306server_ID = 10socket = /data/MysqL56/MysqL.sockpID-file = /data/MysqL56/MysqL.pIDlog-error = /data/MysqL56/data/MysqL.errlog-bin = /data/MysqL56/data/MysqL-bincharacter-set-server = utf8
(*二进制安装,默认配置文件在/etc/my.cnf)
(5)、初始化数据库
> chown -R MysqL.MysqL /data/mysq56> /data/MysqL56/scripts/MysqL_install_db \--defaults-file=/etc/my.cnf \--user=MysqL \--basedir=/data/MysqL56 \--datadir=/data/MysqL56/data
如果出现如下信息
Fatal error: please install the following Perl modules before executingData::Dumper
> yum -y install autoconf
此包安装时会安装Data:Dumper模块
三、配置并启动MysqL
> cp /data/MysqL56/support-files/MysqL.server /etc/init.d/MysqLd> chmod 755 /etc/init.d/MysqLd
(*注意,MysqL二进制安装默认的路径为/usr/local/MysqL,启动脚本里/usr/local/MysqL需要替换)
> sed -i 's#/usr/local/MysqL#/data/MysqL56#g' /data/MysqL56/bin/MysqLd_safe /etc/init.d/MysqLd
启动MysqL
> service MysqLd start
四、添加自启动
> chkconfig --add MysqLd> chkconfig MysqLd on> chkconfig --List MysqLd
五、配置环境变量
> echo 'export PATH=/data/MysqL56/bin:$PATH' >> /etc/profile> source /etc/profile
六、修改MysqL密码(MysqL5.6安装默认root密码为空)
> MysqLadmin -u root password '123456'
七、清理无用的MysqL用户及库
登陆MysqL
> MysqL -uroot -p
查询用户
> select user,host from MysqL.user;
如下所示
+------+-----------------------+| user | host |+------+-----------------------+| root | 127.0.0.1 || root | ::1 || | localhost || root | localhost || | localhost.localdomain || root | localhost.localdomain |+------+-----------------------+
> drop user "root"@"::1";> drop user ""@"localhost";> drop user ""@"localhost.localdomain";> drop user "root"@"localhost.localdomain";
删除无用库
> drop database test;
以上是内存溢出为你收集整理的centos7 二进制安装包安装 mysql5.6全部内容,希望文章能够帮你解决centos7 二进制安装包安装 mysql5.6所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)