#author("2023-07-14T09:32:26+09:00","default:kuji","kuji") CONTENTS #contents ---- Lastmodified &lastmod; ---- *MySQLからMariaDBへ [#x21db8d0] https://gihyo.jp/admin/clip/01/fdt/201305/30 #author("2023-07-14T09:42:18+09:00","default:kuji","kuji") https://www.unixmen.com/migrate-from-mysql-to-mariadb-in-freebsd/ **MySQL > MariaDB 移行を開始する前にデータベースをバックアップしてください。 [#q63a0c89] **次のコマンドを使用して MySQL デーモンを停止します。 [#t71abe99] # service mysql-server stop **Update ports collection [#e0b57331] ** Check which version of MySQL you have: [#m2fdbfc3] # 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 [#o270df08] # 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: [#ff13e428] # cd /usr/ports/databases/mariadb-server # make install clean **You should check following options: [#j91f020b] [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: [#l59f6e75] # cd /usr/ports/databases/mariadb-scripts/ # make install clean ** Check if all ports installed OK: [#p8474c02] # 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: [#m532b121] # service mysql-server start **9) If you didn’t have a MySQL server before, you should create password for root user after MariaDB installation: [#x45782e0] # mysqladmin -u root password YOURSECUREPASSWORD **10) Some tips if you get errors like this: [#y1d5a563] /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; | Engine | Support | Comment | Transactions | XA | Savepoints |h | MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO | | InnoDB | YES | XtraDB engine based on InnoDB plugin. Supports transactions, row-level locking, and foreign keys | YES | YES | YES | | PBXT | YES | High performance, multi-versioning transactional engine | YES | YES | NO | | MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO | | CSV | YES | CSV storage engine | NO | NO | NO | | SPHINX | YES | Sphinx storage engine 0.9.9 | NO | NO | NO | | Aria | YES | Crash-safe tables with MyISAM heritage | NO | NO | NO | | MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO | 8 rows in set (0.00 sec) MariaDB [(none)]> exit; ---- Total access &counter(total);:本日 &counter(today);:昨日 &counter(yesterday); #counter([total|today|yesterday]);