CentOS 6.5 二进制安装MySQL 5.6

前端之家收集整理的这篇文章主要介绍了CentOS 6.5 二进制安装MySQL 5.6前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

CentOS 6.5 二进制安装MysqL 5.6

--------------------------------


下载MysqL5.6二进制包

MysqL-5.6.20-linux-glibc2.5-x86_64.tar.gz



安装相关依赖包

yum install libaio*

useradd MysqL


安装MysqL到/data/MysqL/data下


tar zxvf MysqL-5.6.20-linux-glibc2.5-x86_64.tar.gz -C /data/

mv MysqL-5.6.20-linux-glibc2.5-x86_64 MysqL



修改MysqL的各级文件夹和文件的创建者、创建组为MysqL(注意语句后面有个.)


chown -R MysqL.MysqL /data/MysqL


至此MysqL已经安装完了,

但还需要初始化,初始化MysqL表、test表、infomation表等。


/data/MysqL/scripts/MysqL_install_db --datadir=/data/MysqL/data --basedir=/data/MysqL --user=MysqL --explicit_defaults_for_timestamp

-------------------------------------------------------------------------------------------------------------------------------------


拷贝启动脚本

cp /data/MysqL/support-files/MysqL.server /etc/init.d/MysqLd

 

ln -s /data/MysqL/include /usr/include/MysqL


echo "/data/MysqL/lib" > /etc/ld.so.conf.d/MysqL.conf && ldconfig -v


ln -s /data/MysqL/bin/MysqL /usr/bin



修改配置文件my.cnf


cd /data/MysqL

cp my.cnf /etc/my.cnf


vim /etc/my.cnf


[MysqLd]中添加

basedir = /data/MysqL

datadir = /data/MysqL/data

port = 3306

server_id = 1


-------------------------  


启动MysqL服务


chkconfig MysqLd on

service MysqLd start

  


登陆MysqL并且删除用户

MysqL


MysqL> SELECT user,host,password FROM MysqL.user;

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

| user | host | password |

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

| root | localhost | |

| root | localhost.localdomain | |

| root | 127.0.0.1 | |

| root | ::1 | |

| | localhost | |

| | localhost.localdomain | |

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

6 rows in set (0.00 sec)

设置密码()括号里面的为密码,用户名root

MysqL> UPDATE MysqL.user set password = PASSWORD('Zykj@password') WHERE user = 'root';


MysqL> SELECT user,password FROM MysqL.user;


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

| user | host | password |

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

| root | localhost | *11B9ACA21786F766739D0EB1483C5F64212B81AC |

| root | localhost.localdomain | *11B9ACA21786F766739D0EB1483C5F64212B81AC |

| root | 127.0.0.1 | *11B9ACA21786F766739D0EB1483C5F64212B81AC |

| root | ::1 | *11B9ACA21786F766739D0EB1483C5F64212B81AC |

| | localhost | |

| | localhost.localdomain | |

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

6 rows in set (0.00 sec)



MysqL> DROP USER ''@localhost;

MysqL> FLUSH PRIVILEGES;


MysqL> quit


---------------------MysqL安装完成-------------------------------


设置/修改 密码

MysqL> grant all privileges on *.* to 'root'@'localhost' identified by 'Zykj@password' with grant option;

MysqL> flush privileges;

原文链接:https://www.f2er.com/centos/377134.html

猜你在找的CentOS相关文章