資源描述:
《linux下mysql_rpm安裝》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫。
1、環(huán)境:Redhat5.5MySQL-client-5.6.14-1.rhel5.i386.rpmMySQL-server-5.6.14-1.rhel5.i386.rpmMySQL-shared-5.6.14-1.rhel5.i386.rpm1、查看MySQL及相關(guān)RPM包,是否安裝:[root@localhost~]#rpm-qa
2、grep-imysqlmysql-libs-5.1.66-2.el6_3.x86_64[root@localhost~]#yum-yremovemysql-libs*2、下載Linux對應(yīng)的RPM包,如
3、:CentOS6.4_64對應(yīng)的RPM包,如下:MySQL-client-5.6.15-1.el6.x86_64.rpmMySQL-devel-5.6.15-1.el6.x86_64.rpmMySQL-server-5.6.15-1.el6.x86_64.rpm或:MySQL-client-5.6.14-1.rhel5.i386.rpmMySQL-server-5.6.14-1.rhel5.i386.rpmMySQL-shared-5.6.14-1.rhel5.i386.rpm3、安裝MySQLrpm-ivhMySQL-*#修改配
4、置文件位置[root@localhostrpm]#cp/usr/share/mysql/my-default.cnf/etc/my.cnf4、初始化MySQL及設(shè)置密碼[root@localhostrpm]#/usr/bin/mysql_install_db[root@localhostrpm]#servicemysqlstart[root@localhostrpm]#cat/root/.mysql_secret?#查看root賬號密碼#TherandompasswordsetfortherootuseratSunMay109:1
5、9:382016(localtime):Cb34wy5w[root@localhost~]#mysql-uroot–pqKTaFZnlmysql>SETPASSWORD=PASSWORD('123456');????#設(shè)置密碼為123456mysql>?exit[root@localhost~]#mysql-uroot-p1234565、允許遠程登陸mysql>usemysql;mysql>?select?host,user,passwordfromuser;mysql>updateuser?set?password=passwo
6、rd('123456')whereuser='root';mysql>updateuser?set?host='%'?whereuser='root'?andhost='localhost';mysql>flushprivileges;mysql>?exit6、設(shè)置開機自啟動[root@localhost~]#chkconfigmysqlon[root@localhost~]#chkconfig--list
7、grepmysqlmysql????0:off??1:off??2:on???3:on???4:on???5:on???6:
8、off7、MySQL的默認安裝位置/var/lib/mysql/???????????????#數(shù)據(jù)庫目錄/usr/share/mysql??????????????#配置文件目錄/usr/bin?????????????????????#相關(guān)命令目錄/etc/init.d/mysql??????????????#啟動腳本8、修改字符集和數(shù)據(jù)存儲路徑配置/etc/my.cnf文件,修改數(shù)據(jù)存放路徑、mysql.sock路徑以及默認編碼utf-8.[client]password=123456port=3306default-cha
9、racter-set=utf8[mysqld]port=3306character_set_server=utf8character_set_client=utf8collation-server=utf8_general_ci#(注意linux下mysql安裝完后是默認:表名區(qū)分大小寫,列名不區(qū)分大小寫;0:區(qū)分大小寫,1:不區(qū)分大小寫)lower_case_table_names=1#(設(shè)置最大連接數(shù),默認為151,MySQL服務(wù)器允許的最大連接數(shù)16384;)max_connections=1000[mysql]defaul
10、t-character-set=utf89、查看字符集showvariableslike'%collation%';showvariableslike'%char%';查看防火墻狀態(tài):serviceiptablesstatus查看防火墻狀態(tài)serv