<script type="text/javascript"><!-- google_ad_client = "pub-7343546549496470"; google_ad_width = 468; google_ad_height = 60; google_ad_format = "468x60_as"; google_ad_type = "image"; //2007-07-26: CSDN google_ad_channel = "6063905817"; google_color_border = "6699CC"; google_color_bg = "E6E6E6"; google_color_link = "FFFFFF"; google_color_text = "333333"; google_color_url = "AECCEB"; google_ui_features = "rc:6"; // --></script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
<!--Google 468*60橫幅廣告結(jié)束-->
1)
# groupadd mysql
# useradd mysql -g mysql
2)
進(jìn)入mysql安裝目錄后執(zhí)行
./scripts/mysql_install_db --user=mysql
(初試化表并且規(guī)定用mysql用戶來訪問。初始化表以后就開始給mysql和root用戶設(shè)定訪問權(quán)限)
3)
chown -R root .
chown -R mysql data
(data目錄里面存的是mysql的數(shù)據(jù)庫文件.這個(gè)目錄是在/etc/my.cnf中有配置,在mysql_install_db時(shí)產(chǎn)生)
chown -R mysql data /.
(設(shè)定mysql用戶能訪問/usr/local/mysql/data/mysql下的所有文件)
chgrp -R mysql .
(設(shè)定mysql組能夠訪問/usr/local/mysql)
4)
啟動(dòng)
./bin/mysqld_safe --user=mysql &
(如果沒有問題的話,應(yīng)該會(huì)出現(xiàn)類似這樣的提示:
[1] 42264
# Starting mysqld daemon with databases from /usr/local/mysql/var
如果出現(xiàn) mysql ended這樣的語句,表示Mysql沒有正常啟動(dòng),你可以到log中查找問題,Log文件的通常在/etc/my.cnf中配置。大多數(shù)問題是權(quán)限設(shè)置不正確引起的。)
5)
修改默認(rèn)密碼
./bin/mysqladmin -u root password yourpassword
6)
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
# chmod 700 /etc/init.d/mysqld
# chkconfig --add mysqld
# chkconfig --level 345 mysqld on
(設(shè)置使mysql每次啟動(dòng)都能自動(dòng)運(yùn)行)
7)
# service mysqld start
# netstat –atln
(啟動(dòng)mysql服務(wù),查看端口號(hào))
service mysqld status(查看服務(wù)狀態(tài))
service mysqld stop(停止服務(wù))
mysqladmin –u root –p test shutdown(停止mysql)
8)
設(shè)置其他機(jī)器訪問mysql
insert into user(Host,User,Password) values('192.168.117.54','test',password('test'));
flush privileges;
9)
# cp support-files/my-medium.cnf /etc/my.cnf
(使用mysql其他模板覆蓋默認(rèn)模板)
<!--新Google 468*60橫幅廣告開始-->
<script type="text/javascript"><!-- google_ad_client = "pub-7343546549496470"; /* 468x60, 創(chuàng)建于 08-8-6 */ google_ad_slot = "7368701459"; google_ad_width = 468; google_ad_height = 60; // --></script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
<!--新Google 468*60橫幅廣告結(jié)束--><!--新Google 468x15 橫鏈接單元開始-->
<script type="text/javascript"><!-- google_ad_client = "pub-7343546549496470"; /* 468x15 橫鏈接單元 */ google_ad_slot = "5785741422"; google_ad_width = 468; google_ad_height = 15; // --></script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
<!--新Google 468x15 橫鏈接單元結(jié)束-->
轉(zhuǎn)自【http://jythoner.javaeye.com/blog/277778】
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元
