首先下载下面三个文件:
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
- [root@localhostdownload]#rpm-ivh--replacefilesMySQL-server-5.6.13-1.el6.x86_64.rpm
- Preparing...###########################################[100%]
- 1:MySQL-server###########################################[100%]
- [root@localhostdownload]#rpm-ivh--replacefilesMySQL-client-5.6.13-1.el6.x86_64.rpm
- Preparing...###########################################[100%]
- 1:MySQL-client###########################################[100%]
- [root@localhostdownload]#rpm-ivh--replacefilesMySQL-devel-5.6.13-1.el6.x86_64.rpm
- Preparing...###########################################[100%]
- 1:MySQL-devel###########################################[100%]
2.初始化数据库:
/usr/bin/mysql_install_db
3.启动mysql服务:
servicemysqlstart
使用命令ps-ef|grepmysql查看mysql进程:
- [root@localhost~]#ps-ef|grepmysql
- root260471018:14pts/1200:00:00/bin/sh/usr/bin/mysqld_safe--datadir=/var/lib/mysql--pid-file=/var/lib/mysql/localhost.localdomain.pid
- 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
- root2654524726018:27pts/800:00:00grepmysql
首先查看cat/root/.mysql_secret
- root@localhost~]#cat/root/.mysql_secret
- #TherandompasswordsetfortherootuseratFriAug3015:57:182013(localtime):fMYcarvB
- [root@localhost~]#mysql-uroot-p
- Enterpassword:
- WelcometotheMySQLmonitor.Commandsendwith;or\g.
- YourMySQLconnectionidis5
- Serverversion:5.6.13MySQLCommunityServer(GPL)
- Copyright(c)2000,2013,Oracleand/oritsaffiliates.Allrightsreserved.
- OracleisaregisteredtrademarkofOracleCorporationand/orits
- affiliates.Othernamesmaybetrademarksoftheirrespective
- owners.
- Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.
- mysql>usemysql
- Databasechanged
- mysql>updateusersetpassword=password('root')whereuser='root';
- QueryOK,0rowsaffected(0.15sec)
- Rowsmatched:5Changed:0Warnings:0
- mysql>flushprivileges;
- QueryOK,0rowsaffected(0.00sec)
5.设置远程登陆:
使用root登陆到mysql后
- mysql>updateusersethost='%'whereuser='root';
- ERROR1062(23000):Duplicateentry'%-root'forkey'PRIMARY'
- mysql>selecthost,userfromuser;
- +-----------------------+------+
- |host|user|
- +-----------------------+------+
- |%|root|
- |127.0.0.1|root|
- |192.168.128.142|root|
- |::1|root|
- |localhost.localdomain|root|
- +-----------------------+------+
- 5rowsinset(0.00sec)
- mysql>grantallprivilegeson*.*to'root'@'%'withgrantoption;
- QueryOK,0rowsaffected(0.08sec)
- mysql>exit
- Bye
- [root@localhost~]#servicemysqlrestart
- ShuttingdownMySQL..SUCCESS!
- StartingMySQL..SUCCESS!
分享,快乐,成长
转载请注明出处:http://blog.youkuaiyun.com/fansy1990