redhat6.3安装MySQL-server-5.6.13-1.el6.x86_64.rpm

本文介绍如何在Linux环境下安装MySQL 5.6,并提供详细的步骤指导,包括安装过程、初始化数据库、启动服务及设置root密码等关键操作。

首先下载下面三个文件:

MySQL-client-5.6.13-1.el6.x86_64.rpm
MySQL-devel-5.6.13-1.el6.x86_64.rpm
MySQL-server-5.6.13-1.el6.x86_64.rpm
然后使用root账号登陆,进行安装:

1. 安装server、devel、client:1. 安装server、devel、client:

rpm-ivh--replacefilesMySQL-s*.rpm

rpm -ivh --replacefiles MySQL-d*.rpm

rpm-ivh--replacefilesMySQL-c*.rpm

  1. [root@localhostdownload]#rpm-ivh--replacefilesMySQL-server-5.6.13-1.el6.x86_64.rpm
  2. Preparing...###########################################[100%]
  3. 1:MySQL-server###########################################[100%]
  4. [root@localhostdownload]#rpm-ivh--replacefilesMySQL-client-5.6.13-1.el6.x86_64.rpm
  5. Preparing...###########################################[100%]
  6. 1:MySQL-client###########################################[100%]
  7. [root@localhostdownload]#rpm-ivh--replacefilesMySQL-devel-5.6.13-1.el6.x86_64.rpm
  8. Preparing...###########################################[100%]
  9. 1:MySQL-devel###########################################[100%]
要移除安装可以使用rpm-eMySQL-server、rpm-eMySQL-devel、MySQL-client即可;

2.初始化数据库:

/usr/bin/mysql_install_db

3.启动mysql服务:

servicemysqlstart

使用命令ps-ef|grepmysql查看mysql进程:

  1. [root@localhost~]#ps-ef|grepmysql
  2. root260471018:14pts/1200:00:00/bin/sh/usr/bin/mysqld_safe--datadir=/var/lib/mysql--pid-file=/var/lib/mysql/localhost.localdomain.pid
  3. mysql2622726047018:14pts/1200:00:01/usr/sbin/mysqld--basedir=/usr--datadir=/var/lib/mysql--plugin-dir=/usr/lib64/mysql/plugin--user=mysql--log-error=/var/log/mysqld.log--pid-file=/var/lib/mysql/localhost.localdomain.pid--socket=/var/lib/mysql/mysql.sock
  4. root2654524726018:27pts/800:00:00grepmysql
4 .第一次登陆设置root密码:

首先查看cat/root/.mysql_secret

  1. root@localhost~]#cat/root/.mysql_secret
  2. #TherandompasswordsetfortherootuseratFriAug3015:57:182013(localtime):fMYcarvB
然后命令行:mysql-uroot-p,然后输入上面的密码即可:

  1. [root@localhost~]#mysql-uroot-p
  2. Enterpassword:
  3. WelcometotheMySQLmonitor.Commandsendwith;or\g.
  4. YourMySQLconnectionidis5
  5. Serverversion:5.6.13MySQLCommunityServer(GPL)
  6. Copyright(c)2000,2013,Oracleand/oritsaffiliates.Allrightsreserved.
  7. OracleisaregisteredtrademarkofOracleCorporationand/orits
  8. affiliates.Othernamesmaybetrademarksoftheirrespective
  9. owners.
  10. Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.
设置root密码:

  1. mysql>usemysql
  2. Databasechanged
  3. mysql>updateusersetpassword=password('root')whereuser='root';
  4. QueryOK,0rowsaffected(0.15sec)
  5. Rowsmatched:5Changed:0Warnings:0
  6. mysql>flushprivileges;
  7. QueryOK,0rowsaffected(0.00sec)
退出,重新登陆即可使用新的密码登陆;

5.设置远程登陆:

使用root登陆到mysql后

  1. mysql>updateusersethost='%'whereuser='root';
  2. ERROR1062(23000):Duplicateentry'%-root'forkey'PRIMARY'
  3. mysql>selecthost,userfromuser;
  4. +-----------------------+------+
  5. |host|user|
  6. +-----------------------+------+
  7. |%|root|
  8. |127.0.0.1|root|
  9. |192.168.128.142|root|
  10. |::1|root|
  11. |localhost.localdomain|root|
  12. +-----------------------+------+
  13. 5rowsinset(0.00sec)
然后:

  1. mysql>grantallprivilegeson*.*to'root'@'%'withgrantoption;
  2. QueryOK,0rowsaffected(0.08sec)
  3. mysql>exit
  4. Bye
  5. [root@localhost~]#servicemysqlrestart
  6. ShuttingdownMySQL..SUCCESS!
  7. StartingMySQL..SUCCESS!
重启mysql即可远程登陆。

分享,快乐,成长


转载请注明出处:http://blog.youkuaiyun.com/fansy1990

 
 
 
 
 
 
 
 
 

                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值