- 追加された行はこの色です。
- 削除された行はこの色です。
[[Linuxめも]]
*MySQL [#mdf33c2b]
MySQLではInnoDBエンジンのデフォルトでは、単一カラムインデックスのインデックスキーは最大で 767 バイトまでしか指定できません。~
https://dev.mysql.com/doc/refman/5.6/ja/innodb-restrictions.html
ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes
my.confの設定変更により、3,072byteに拡張することができます。
innodb_file_per_table = 1
innodb_file_format = Barracuda
[mysqld]
innodb_large_prefix
innodb_file_per_table=1
innodb_file_format=Barracuda
MySQL5.7.7からはファイルフォーマットはBarracudaが標準となるため、上記の記述は不要となります。~
https://dev.mysql.com/doc/refman/5.7/en/innodb-restrictions.html
767byte制限がかかっている場合はutf8ではインデックスを作成するカラムは255文字。~
MySQL5.5からサポートされるutf8mb4では191文字となります。
*MariaDB [#e7a4f66c]
MariaDBの場合、バージョン10.1ではダメっぽいのでバージョンを上げます。~
リポジトリをインストールしてupdate。
$ curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
$ sudo yum update MariaDB
怒られたので手動で行う必要がありそうです。
A MySQL or MariaDB server package (MariaDB-server-10.1.32-1.el7.centos.x86_64) is installed.
Upgrading directly from MySQL 10.1 to MariaDB 10.2 may not
be safe in all cases. A manual dump and restore using mysqldump is
recommended. It is important to review the MariaDB manual's Upgrading
section for version-specific incompatibilities.
A manual upgrade is required.
- Ensure that you have a complete, working backup of your data and my.cnf
files
- Shut down the MySQL server cleanly
- Remove the existing MySQL packages. Usually this command will
list the packages you should remove:
rpm -qa | grep -i '^mysql-'
You may choose to use 'rpm --nodeps -ev <package-name>' to remove
the package which contains the mysqlclient shared library. The
library will be reinstalled by the MariaDB-shared package.
- Install the new MariaDB packages supplied by MariaDB Foundation
- Ensure that the MariaDB server is started
- Run the 'mysql_upgrade' program
This is a brief description of the upgrade process. Important details
can be found in the MariaDB manual, in the Upgrading section.
念の為に各データベースのdumpは取っておきましょう。
MariaDBを停止。
# systemctl stop mysql
MariaDBをアンインストールして、再度インストール。
# yum remove MariaDB-*
# yum install MariaDB
Postfixもアンインストールされてしまうので、再度インストールします。
# yum install postfix
バックアップされていたmy.cnfを復活。
# mv /etc/my.cnf.rpmsave /etc/my.cnf
MariaDBを起動してupgradeコマンドを実行。
# systemctl start mysql
# mysql_upgrade
$ mysql --version
mysql Ver 15.1 Distrib 10.2.14-MariaDB, for Linux (x86_64) using readline 5.1