分享java帶來的快樂

          我喜歡java新東西

          在linux自帶mysql基礎(chǔ)上再裝新的mysql

          預(yù)處理:
          rpm -q mysql;
          rpm -e --nodeps mysql;

          1.groupadd mysql
          2.useradd -g mysql mysql
          3.下載 mysql-standard-5.0.21-linux-i686-glibc23.tar.gz
          4.放到/usr/local
          5.tar -xvzf mysql-standard-5.0.21-linux-i686-glibc23.tar.gz
          6.ln -s mysql****** mysql (將解壓后的mysql目錄軟連接成mysql,或者直接更名為mysql也可,只是以后沒辦法看mysql版本)
          7.chown -R mysql.mysql mysql (一定要帶-R)
          8.執(zhí)行一下./scripts/mysql_install_db --user=mysql (注意一定要在/usr/local/mysql目錄下執(zhí)行該命令,不能到scripts下執(zhí)行mysql_install_db,目錄結(jié)構(gòu)有關(guān)系)
          9.這時(shí)將在/usr/local/mysql/data 生成一個(gè)用戶數(shù)據(jù)庫(mysql)和一個(gè)test數(shù)據(jù)庫 (一定要確認(rèn))
          10.把/etc/my.cnf文件改名或刪掉
          11.cd /usr/local/mysql/support-file
          12.cp mysql.server /etc/rc.d/init.d/mysqld
          13.cp my-huge.cnf ../data
          14.所有操作都是用root的 
          啟動(dòng)mysql用以下兩種方式均可
          (1)/etc/rc.d/init.d/mysqld start 
          (2)service mysqld start
          15.修改root密碼
           mysqladmin -u root password 'new-password'
          16.創(chuàng)建用戶,后付所有權(quán)限

          1 用于程序發(fā)布中,指定數(shù)據(jù)庫,指定用戶,權(quán)限小不影響工作(程序和數(shù)據(jù)庫服務(wù)器在同一臺(tái)機(jī)器上,否則用指定IP或域名)
          grant select, insert, update, delete on notebase.* to nb@localhost identified by 'nb123';

          不推薦使用%,這樣所有的IP都能連接,不過只能對notebase操作
          grant select, insert, update, delete on notebase.* to nb@"%" identified by 'nb123';

          2 用于程序開發(fā)中,讓指定開發(fā)人員的機(jī)器有最高訪問權(quán)限
          grant ALL PRIVILEGES on *.* to root@"10.0.0.11" Identified by "root" WITH GRANT OPTION;

          flush privileges

          17.進(jìn)入mysql
           mysql -uroot -p770511
          18.關(guān)閉數(shù)據(jù)庫:
           mysqladmin -uroot -pxxxx -hxxxxxxxxx  shutdown
          19(啟動(dòng),關(guān)閉,連接數(shù)據(jù)庫時(shí)可能出現(xiàn) 無法找到/usr/lib/mysql/mysql.sock錯(cuò)誤,這是因?yàn)椋瑱C(jī)器本身自帶的mysql 把socket通信文件指定在/usr/lib/mysql/mysql.sock,這時(shí)只要將本身自帶的mysql和mysqladmin命令文件刪除,并把/usr/local/mysql/bin置入PATH環(huán)境變量即可正常使用)



          Installing MySQL system tables...
          OK
          Filling help tables...
          OK

          To start mysqld at boot time you have to copy
          support-files/mysql.server to the right place for your system

          PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
          To do so, start the server, then issue the following commands:

          /usr/local/mysql/bin/mysqladmin -u root password 'new-password'
          /usr/local/mysql/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

          Alternatively you can run:
          /usr/local/mysql/bin/mysql_secure_installation

          which will also give you the option of removing the test
          databases and anonymous user created by default.  This is
          strongly recommended for production servers.

          See the manual for more instructions.

          You can start the MySQL daemon with:
          cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &

          You can test the MySQL daemon with mysql-test-run.pl
          cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl

          Please report any problems with the /usr/local/mysql/bin/mysqlbug script!

           

          posted on 2006-05-05 16:22 強(qiáng)強(qiáng) 閱讀(875) 評論(0)  編輯  收藏 所屬分類: mysql

          主站蜘蛛池模板: 新晃| 株洲县| 库车县| 祁门县| 无极县| 章丘市| 喀什市| 桦川县| 蒙自县| 阿图什市| 泰安市| 四会市| 双流县| 锡林郭勒盟| 罗田县| 龙山县| 长沙市| 嘉禾县| 柘城县| 浦江县| 金寨县| 荆州市| 清徐县| 乌审旗| 礼泉县| 黄石市| 敖汉旗| 绥江县| 南安市| 盖州市| 蕉岭县| 科尔| 沾化县| 贵州省| 淅川县| 南宫市| 成都市| 介休市| 兰西县| 黄平县| 万山特区|