Google Code Prettify

星期一, 1月 27, 2014

MySQL migrate to MariaDB - ubuntu phpmyadmin

As developer is hardly to find a help from Oracle's MySQL and google is also moving to MariaDB, this article will show how to migrate MySQL5.5 to MariaDB5.5.

Original Backend System:
  • php version: 5.3.10-1ubuntu3.8 (phpmyadmin)
  • Server API: Apache2
  • MySQL: 5.5
Original Command Set for ubuntu12.04...
$ sudo apt-get install apache2 mysql-server mysql-client php5 php5-gd php5-mysql
$ sudo apt-get install phpmyadmin
$ sudo a2enmod rewrite //lanuch mod_rewrite module
$ sudo /etc/init.d/apache2 restart 

Start to moving MySQL5.5 to MariaDB...

Go to MaraiaDB Downloads website select which one you want to down...
  • in this case, I choose MariaDB Galera Cluster 5.5 Series
    >>my Distro (ubuntu) -> Release (12.04 LTS "precise" -> Version (5.5) -> Mirror (山形大学, 米沢市 - Yamagata University, Yonezawa) 

$ sudo vim /etc/apt/sources.list //open the sources.list file
  • copy and paste the following commands to /etc/apt/sources.list
    # MariaDB 5.5 repository list - created 2014-01-27 05:51 UTC
    # http://mariadb.org/mariadb/repositories/
    deb http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/5.5/ubuntu 
                      precise main
    deb-src http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/5.5/ubuntu 
                      precise main
continue...
$ sudo apt-get install python-software-properties
$ sudo apt-key adv --recv-keys --keyserver 
          hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
$ sudo apt-get update
$ sudo apt-get install mariadb-galera-server galera
  • if you get an error like this:
    The following packages have unmet dependencies:
     mariadb-server : Depends: mariadb-server-5.5 but it is not going to ...
            be installed
    E: Unable to correct problems, you have held broken packages.
    
  • check maysql-common and libmysqlclient18 have any related package as MariaDB suggestion..
    $ apt-cache show mysql-common | grep Version
    $ apt-cache show libmysqlclient18 | grep Version
    >>in my case, select "5.5.34+maria-1~squeeze" ....
    Version: 5.5.35-0ubuntu0.12.04.1
    Version: 5.5.34+maria-1~squeeze
    Version: 5.5.22-0ubuntu1
install MaraDB
$ apt-get install mariadb-server-5.5 mariadb-client-5.5 \ 
               libmysqlclient18="5.5.34+maria-1~squeeze" \ 
               mysql-common="5.5.34+maria-1~squeeze"

if found an error as following...
...
E: Unable to locate package libmysqlclient18
E: Unable to locate package mysql-common

Only install two packages libmysqlclient18 and mysql-common ...
$ sudo apt-get install libmysqlclient18="5.5.34+maria-1~squeeze" 
                  mysql-common="5.5.34+maria-1~squeeze"

then... will install mariadb-galera-server successfully ^_^
$ sudo apt-get install mariadb-galera-server galera

then ... put your MaraDB passward... as MySQL setting..

restart the database and apache2...
$ sudo /etc/init.d/mysql start
$ sudo /etc/init.d/apache2 restart

Finally, the website will be moving successfully..

Reference:
installing mariadb deb files https://mariadb.com/kb/en/installing-mariadb-deb-files/

沒有留言: