分享java帶來的快樂

          我喜歡java新東西

          在linux自帶mysql基礎上再裝新的mysql

          預處理:
          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.執行一下./scripts/mysql_install_db --user=mysql (注意一定要在/usr/local/mysql目錄下執行該命令,不能到scripts下執行mysql_install_db,目錄結構有關系)
          9.這時將在/usr/local/mysql/data 生成一個用戶數據庫(mysql)和一個test數據庫 (一定要確認)
          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的 
          啟動mysql用以下兩種方式均可
          (1)/etc/rc.d/init.d/mysqld start 
          (2)service mysqld start
          15.修改root密碼
           mysqladmin -u root password 'new-password'
          16.創建用戶,后付所有權限

          1 用于程序發布中,指定數據庫,指定用戶,權限小不影響工作(程序和數據庫服務器在同一臺機器上,否則用指定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 用于程序開發中,讓指定開發人員的機器有最高訪問權限
          grant ALL PRIVILEGES on *.* to root@"10.0.0.11" Identified by "root" WITH GRANT OPTION;

          flush privileges

          17.進入mysql
           mysql -uroot -p770511
          18.關閉數據庫:
           mysqladmin -uroot -pxxxx -hxxxxxxxxx  shutdown
          19(啟動,關閉,連接數據庫時可能出現 無法找到/usr/lib/mysql/mysql.sock錯誤,這是因為,機器本身自帶的mysql 把socket通信文件指定在/usr/lib/mysql/mysql.sock,這時只要將本身自帶的mysql和mysqladmin命令文件刪除,并把/usr/local/mysql/bin置入PATH環境變量即可正常使用)



          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 強強 閱讀(865) 評論(0)  編輯  收藏 所屬分類: mysql

          主站蜘蛛池模板: 南阳市| 乌拉特后旗| 象州县| 沙洋县| 巴彦县| 始兴县| 龙胜| 唐河县| 湖北省| 灵川县| 芜湖县| 肥西县| 道真| 万山特区| 宝兴县| 黎川县| 石景山区| 乐都县| 南漳县| 棋牌| 德江县| 通河县| 中江县| 红河县| 邵阳县| 繁峙县| 洞口县| 丰台区| 瑞安市| 麻栗坡县| 盘山县| 虞城县| 丹棱县| 潞西市| 双柏县| 礼泉县| 前郭尔| 渭南市| 定西市| 正宁县| 淮滨县|