CentOS 5.6下MySQL遷移

來源:互聯網
上載者:User

這周主要遷移兩套EMC儲存,有幾台內網的資料庫伺服器掛載的儲存空間,需要把儲存上的資料庫遷移伺服器上,下面記錄具體遷移步驟:

一、環境:

1.原資料庫伺服器:172.28.29.21(掛載EMC到/sandata目錄)

2.先資料庫伺服器:10.20.220.107

二、具體思路:

1.在10.20.220.107上做NFS,把/data/db給172.28.29.21掛載

2.在172.28.29.21上把10.20.220.107的/data/db掛載到/data/db

3.在172.28.29.21上把/sandata目錄下的mysql資料庫目錄DB下的所有檔案copy到/data/db下

4.在10.20.220.107上安裝mysql資料庫,www.bkjia.com 把資料庫路徑指到/data/db

5.測試

三、實施步驟

1.前面三步很簡單了,在這裡就不說了,下面我們安裝mysql資料庫

a.先安裝ncurses-devel

[root@localhost ~]# yum install ncurses-devel

b.安裝mysql

[root@localhost ~]# useradd mysql -s /sbin/nologin

[root@localhost ~]# tar -zxvf mysql-5.1.54.tar.gz
[root@localhost ~]# cd mysql-5.1.54

[root@localhost mysql-5.1.54]# ./configure --prefix=/usr/local/mysql --with-mysqld-user=mysql --with-extra-charsets=all --with-charset=utf8 --with-unix-socket-path=/usr/local/mysql/var/mysql.sock --enable-thread-safe-client --with-plugins=innobase

注意:這步可能報這個錯誤:

config.status: executing libtool commands
/bin/rm: cannot remove `libtoolT': No such file or directory
config.status: executing default commands
解決辦法:

在執行./configure 之前,先執行:
# autoreconf --force --install
# libtoolize --automake --force
# automake --force --add-missing

再次執行:

[root@localhost mysql-5.1.54]# ./configure --prefix=/usr/local/mysql --with-mysqld-user=mysql --with-extra-charsets=all --with-charset=utf8 --with-unix-socket-path=/usr/local/mysql/var/mysql.sock --enable-thread-safe-client --with-plugins=innobase

[root@localhost mysql-5.1.54]# make && make install

#copy一個my.cnf檔案到/etc下,後面我會把內容貼出來的

[root@localhost data]# chown mysql /data/db

[root@localhost db]# chmod 777 /data/db

[root@localhost ~]# /usr/local/mysql/bin/mysql_install_db --user=mysql --datadir=/data/db

[root@localhost db]# /usr/local/mysql/bin/mysqld_safe &

  • 1
  • 2
  • 下一頁

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.