資源描述:
《linux下mysql的安裝過程.docx》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在工程資料-天天文庫。
1、最近在linux安裝了mysql,根據(jù)網(wǎng)上收集的資料和個人的操作過程,大概做了個整理,以便以后進(jìn)行參考回顧。?1、下載mysql-5.1.36.tar.gz,并且解壓.?tar-xzvfmysql-5.1.36.tar.gz?2、添加mysql組,新建mysql用戶?groupaddmysql?useradd-gmysqlmysql?3.進(jìn)入解壓后的目錄下,進(jìn)行編譯安裝?./configure--prefix=/usr/local/mysql--with-charset=utf8--with-extra-ch
2、arsets=all--enable-assembler--enable-thread-safe-client--with-big-tables--with-readline--with-ssl--with-embedded-server--with-plugins=all?4.make?5.makeinstall?6.安裝完成后,mysql的安裝目錄為prefix中指定的/usr/local/mysql?7.進(jìn)入安裝目錄,復(fù)制配置文件?cpsupport-files/my-large.cnf/etc/my.
3、cnf?8.更新/usr/local/mysql文件夾的所有者及用戶組?cd/usr/local/mysql/?chown-Rmysql.?chgrp-Rmysql.?9.配置mysql隨服務(wù)器啟動的服務(wù)?cp/home/mysql-5.1.36/support-files/mysql.server/etc/init.d/mysqld?chmod755/etc/init.d/mysqld?chkconfig--addmysqld?10.初始化mysql?bin/mysql_install_db--user=m
4、ysql?11.啟動mysql服務(wù)?方法1:servicemysqldstart?方法2:/usr/local/mysql/bin/mysqld_safe--user=mysql&?12.關(guān)閉MySQL服務(wù)?/usr/local/mysql/bin/mysqladmin-uroot-p?shutdown//關(guān)閉MySQL?13.查看mysql服務(wù)端口狀態(tài)(3306)??netstat-atln?14.mysql默認(rèn)是沒有密碼的,設(shè)置登錄mysql的新密碼?/usr/local/mysql/bin/mysqla
5、dmin-uroot-password'xxx'?15.登錄msyql?/usr/local/mysql/bin/mysql-uroot-p?16.添加mysql的用戶?登錄mysql,添加mysql用戶?grant權(quán)限on數(shù)據(jù)庫名.表名用戶@登錄主機(jī)identifiedby"用戶密碼";?添加testA,容許localhost登錄,密碼為"123456"?添加testB,容許遠(yuǎn)程登錄,密碼為"123456"?添加testC,容許遠(yuǎn)程登錄,密碼為"123456"?GRANTALLPRIVILEGESON*.*
6、TOtestA@localhostIDENTIFIEDBY'123456'WITHGRANTOPTION;?GRANTALLPRIVILEGESON*.*TOtestB@"%"IDENTIFIEDBY'123456'WITHGRANTOPTION;?grantselect,update,insert,on*.*to?testC@"%"identifiedby"123456";?17.測試一下,在windows下使用mysql客戶端軟件指定IP地址、用戶名、密碼測試連接到linux下的mysql。?18.完畢。
7、?附:?1../configure?--prefix=/usr/local/mysql//MySQL安裝目錄?--datadir=/mydata//數(shù)據(jù)庫存放目錄?--with-charset=utf8//使用UTF8格式?--with-extra-charsets=complex//安裝所有的擴(kuò)展字符集?--enable-thread-safe-client//啟用客戶端安全線程?--with-big-tables//啟用大表?--with-ssl//使用SSL加密?--with-embedded-serv
8、er//編譯成embeddedMySQLlibrary(libmysqld.a),?--enable-local-infile//允許從本地導(dǎo)入數(shù)據(jù)?--enable-assembler//匯編x86的普通操作符,可以提高性能?--with-plugins=innobase//數(shù)據(jù)庫插件?--with-plugins=partition//分表功能,將一個大表分割成多個小表?2.chkconfig?