您的位置:首页 > 运维架构 > Linux

MySQL5.6 centos6.5安装实践

2016-04-24 11:23 459 查看
下载:

MySql下载地址: http://dev.mysql.com/downloads/mysql/


安装:

检查MySQL及相关RPM包,是否安装,如果有安装,则移除

[root@localhost ~]# rpm -qa | grep -i mysql
mysql-libs
[root@localhost ~]# yum -y remove mysql-libs*
[root@localhost ~]# rpm -ivh MySQL-server-5.6.30-1.el6.x86_64.rpm
[root@localhost ~]# rpm -ivh MySQL-client-5.6.29-1.el6.x86_64.rpm


注:MySql配置文件读取顺序,配置my.cnf

[root@localhost] find / -name my.cnf          #查找my.cnf所在位置
[root@localhost] /usr/sbin/mysqld --verbose --help  | grep -A 1 "Default options"
#Default options are read from the following files in the given order:
#/etc/my.cnf /etc/mysql/my.cnf /opt/mysql/etc/my.cnf ~/.my.cnf


开机启动

[root@localhost ~]# chkconfig mysql on
[root@localhost ~]# chkconfig --list | grep mysql
mysql           0:off   1:off   2:on    3:on    4:on    5:on    6:off

MySQL的默认安装位置
/etc/init.d/mysql              #启动脚本,可以查看相关的默认路径
/var/lib/mysql/               #数据库目录
/usr/share/mysql              #配置文件目录
/usr/bin                     #相关命令目录


启动MySQL&初始化密码

[root@localhost] /usr/bin/mysql_install_db
[root@localhost] cat /root/.mysql_secret  #查看root账号密码




[root@localhost ~] mysql -uroot –paKWGvFV1qxvxtD5V
mysql> SET PASSWORD = PASSWORD('123456');    #设置密码为123456
mysql> exit
[root@localhost ~]# mysql -uroot -p123456

允许远程登陆

mysql> use mysql;
mysql> select host,user,password from user;
mysql> update user set password=password('123456') where user='root';
mysql> update user set host='%' where user='root' and host='localhost';
mysql> flush privileges;
mysql> exit
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: