mysql多實例安裝方法

1.CentOS5.8 x86_64位 採用最小化安裝,系統經過了基本優化篇
2.nginx版本:nginx-1.4.7
3.源碼包存放位置:/home/oldboy/tools
4.源碼包編譯安裝位置:/application/
5.已經安裝了單實例的mysql,路徑在/usr/local/mysql

一.mysql多實例啓動設置
    1.新建目錄:
        [root@ser200 ~]# mkdir /data/{3306,3307}/data -p
        [root@ser200 ~]# tree /data
        /data
        |-- 3306
        |   `-- data
        |-- 3307
        |   `-- data
    2.關閉單實例的mysql自動啓
        [root@ser200 3307]# chkconfig --list mysqld
        mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off
        [root@ser200 3307]# chkconfig mysqld off ;
        [root@ser200 3307]# chkconfig --list mysqld
        mysqld          0:off   1:off   2:off   3:off   4:off   5:off   6:off
    3.上傳啓動和配置文件my.cnf,mysql啓動腳本到對應的目錄下面
        [root@ser200 data]# cd 3306
        [root@ser200 3306]# ls
        data
        [root@ser200 3306]# rz
        rz waiting to receive.
        Starting zmodem transfer.  Press Ctrl+C to cancel.
        Transferring my.cnf...
          100%       1 KB       1 KB/sec    00:00:01       0 Errors  
        Transferring mysql...
          100%       1 KB       1 KB/sec    00:00:01       0 Errors
    4.修改/data目錄的屬主
        [root@ser200 bin]# chown mysql:mysql /data
    5.增加mysql啓動腳本的執行權限
        [root@ser200 bin]# chmod 700 /data/3306/mysql
        [root@ser200 bin]# ll /data/3306/mysql       
        -rwx------ 1 mysql mysql 1053 Apr 12  2012 /data/3306/mysql

        [root@ser200 bin]# chmod 700 /data/3307/mysql
    6.安裝數據庫
        [root@ser200 bin]# mysql_install_db --datadir=/data/3307/data --user=mysql
        [root@ser200 bin]# mysql_install_db --datadir=/data/3306/data --user=mysql
    7.設置mysql數據庫的登陸密碼
        [root@ser200 3306]# mysqladmin -uroot password 'mybaby3307' -S /data/3307/mysql.sock
        [root@ser200 3306]# mysql -uroot -p -S /data/3307/mysql.sock
        Enter password:
        Welcome to the MySQL monitor.  Commands end with ; or \g.
        Your MySQL connection id is 2
        Server version: 5.1.73-log Source distributio
    8.安裝過程報錯處理方法:
        A.錯誤1
        InnoDB: Error: auto-extending data file ./ibdata1 is of a different size    #原因,ibdata1和配置文件的大小不對應
        InnoDB: 1024 pages (rounded down to MB) than specified in the .cnf file:
        InnoDB: initial 1088 pages, max 0 (relevant if non-zero) pages!
        InnoDB: Could not open or create data files.
        InnoDB: If you tried to add new data files, and it failed here,
        InnoDB: you should now edit innodb_data_file_path in my.cnf back
        B.錯誤2
        InnoDB: Database physically writes the file full: wait...
        InnoDB: Progress in MB: 100
        InnoDB: Error: all log files must be created at the same time.
        InnoDB: All log files must be created also in database creation.    #目錄下的LOG文件時間ibdata1創建時間不一致
        InnoDB: If you want bigger or smaller log files, shut down the
        InnoDB: database and make sure there were no errors in shutdown.
        InnoDB: Then delete the existing log files. Edit the .cnf file
        InnoDB: and start the database again.
        141027 10:42:26 [ERROR] Plugin 'InnoDB' init function returned error.
        141027 10:42:26 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
        141027 10:42:26 [ERROR] Unknown/unsupported table type: InnoDB
        141027 10:42:26 [ERROR] Aborting

        處理方法:
            刪除ibdata1,ip_*的log,啓動mysql正常
            [root@ser200 data]# rm ibdata1
            rm: remove regular file `ibdata1'?

            [root@ser200 data]# rm ib*
            rm: remove regular file `ibdata1'?
            [root@ser200 data]# rm ib* -f
            [root@ser200 data]# ll
            total 8
            drwx------ 2 mysql root 4096 Oct 27 08:44 mysql
            drwx------ 2 mysql root 4096 Oct 27 08:44 test

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章