CONTENTS


Lastmodified 2023-06-05 (月) 10:25:15


MySQLからMariaDBへ

https://gihyo.jp/admin/clip/01/fdt/201305/30

https://www.unixmen.com/migrate-from-mysql-to-mariadb-in-freebsd/

MySQL > MariaDB 移行を開始する前にデータベースをバックアップしてください。

次のコマンドを使用して MySQL デーモンを停止します。

# service mysql-server stop

Update ports collection

Check which version of MySQL you have:

# pkg_version -v | grep mysql
mysql-client-5.5.17                 =   up-to-date with port
mysql-server-5.5.17                 =   up-to-date with port
...

We need to uninstall MySQL Server & Client ports

# cd /usr/ports/databases/mysql55-server/
# make deinstall clean
# cd /usr/ports/databases/mysql55-client/
# make deinstall clean

Installing MariaDB Server, MariaDB Client and MariaDB Scripts:

# cd /usr/ports/databases/mariadb-server
# make install clean

You should check following options:

[X] SSL        Activate SSL support (yassl)
[X] ARIADB     Aria storage engine
[X] ARCHIVE    Archive storage plugin
[X] BLACKHOLE  Blackhole storage engine
[X] SPHINX     SE client for Sphinx search daemon
[X] FEDX       FederatedX storage engine (Federated replacement)
[X] XTRADB     XtraDB (InnoDB replacement) engine
[X] PBXT       MVCC-based transactional engine

MariaDB Client will be installed automatically. You should now check following options:

[X] THREADSAFE  Build thread-safe client
[X] SSL         Activate SSL support (yassl)

Installing MariaDB Scripts:

# cd /usr/ports/databases/mariadb-scripts/
# make install clean

Check if all ports installed OK:

# pkg_version -v | grep maria 
mariadb-client-5.2.9                =   up-to-date with port
mariadb-scripts-5.2.9               =   up-to-date with port
mariadb-server-5.2.9                =   up-to-date with port

8) Starting MariaDB Server:

# service mysql-server start

9) If you didn’t have a MySQL server before, you should create password for root user after MariaDB installation:

# mysqladmin -u root password YOURSECUREPASSWORD

10) Some tips if you get errors like this:

/libexec/ld-elf.so.1: Shared object "libmysqlclient.so.18" not found, required by "postfix"
#1286 - Unknown table engine 'InnoDB'
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1286 Unknown table engine 'InnoDB': SELECT expire, value FROM {semaphore} WHERE name = :name; Array ( [:name] => variable_init ) in lock_may_be_available() (line 167 of /usr/home/usadentists/usadentists.com/htdocs/includes/lock.inc).

apache-2.2.17_1 cannot install: unknown MySQL version: 52.

Tip 1: If your have Postfix or/and Dovecot with MySQL support, you should re-install them.

Tip 2: If you get message with unknown MySQL version when installing ports, you should edit /etc/make.conf and add line:

MYSQL52_LIBVER=16 Tip 3: If you using Drupal 7, Postfixadmin or other software which requires InnoDB tables or Sphinx Search Engine, you should activate following plugins:

# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4656
Server version: 5.2.9-MariaDB-log Source distribution

This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> INSTALL PLUGIN sphinx SONAME 'ha_sphinx.so';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> INSTALL PLUGIN innodb SONAME 'ha_xtradb.so';
Query OK, 0 rows affected (0.11 sec)

MariaDB [(none)]> show engines;

  1. ------------+---------+--------------------------------------------------------------------------------------------------+--------------+------+------------+
    EngineSupportCommentTransactionsXASavepoints
  2. ------------+---------+--------------------------------------------------------------------------------------------------+--------------+------+------------+
    MyISAMDEFAULTDefault engine as of MySQL 3.23 with great performanceNONONO
    InnoDBYESXtraDB engine based on InnoDB plugin. Supports transactions, row-level locking, and foreign keysYESYESYES
    PBXTYESHigh performance, multi-versioning transactional engineYESYESNO
    MEMORYYESHash based, stored in memory, useful for temporary tablesNONONO
    CSVYESCSV storage engineNONONO
    SPHINXYESSphinx storage engine 0.9.9NONONO
    AriaYESCrash-safe tables with MyISAM heritageNONONO
    MRG_MYISAMYESCollection of identical MyISAM tablesNONONO
  3. ------------+---------+--------------------------------------------------------------------------------------------------+--------------+------+------------+ 8 rows in set (0.00 sec)

MariaDB [(none)]> exit;


Total access 72:本日 2:昨日 0

Counter: 72, today: 2, yesterday: 0

トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2023-06-05 (月) 10:25:15