#author("2020-07-22T07:58:41+00:00","default:wikiwriter","wikiwriter") &tag(MacPorts/mysql8); *目次 [#w448a619] #contents *関連ページ [#m4d68432] *参考情報 [#d8ae446d] *インストール [#haf1dd4a] -mysql55-serverのアンインストール sudo port uninstall mysql55-server -mysql8-serverのインストール sudo port install mysql8-server -以下の警告が表示される(無視してOK?) #pre{{ Warning: ----------------------------------------------------------------------- Warning: The port 'mysql8' uses the cxx11 PortGroup which is deprecated. Warning: Please instead specify the required c++ standard directly using Warning: compiler.cxx_standard 2011 Warning: replacing 2011 with newer standards (e.g. 2014, 2017) as required. Warning: For more details see https://trac.macports.org/wiki/CompilerSelection Warning: ----------------------------------------------------------------------- }} -以下のインストラクションが表示される #pre{{ ---> Some of the ports you installed have notes: mysql8 has the following notes: On activation if no /opt/local/etc/mysql8/my.cnf file exists one will be created which loads /opt/local/etc/mysql8/macports-default.cnf. If a /opt/local/etc/mysql8/my.cnf file exists MacPorts does not touch it and any changes you make to /opt/local/etc/mysql8/my.cnf will be preserved (e.g., during port upgrades, deactivations or activations). /opt/local/etc/mysql8/my.cnf is a good place to customize your mysql8 installation. Any changes made to /opt/local/etc/mysql8/macports-default.cnf will be lost during port upgrades, deactivations or activations so you are advised to not make changes here. Currently /opt/local/etc/mysql8/macports-default.cnf contains only one directive; to disable networking. With disabled networking it is possible to install and have running all the MacPorts mysql ports simultaneously. To set mysql8 as your preferred version of MySQL, use `port select`, as follows: $ sudo port select mysql mysql8 mysql8-server has the following notes: If this is a new install you might want to run: $ sudo /opt/local/lib/mysql8/bin/mysqld --initialize --user=_mysql $ sudo port load mysql8-server $ /opt/local/lib/mysql8/bin/mysql_secure_installation The first command creates the necessary files for the MySQL database service. (Remember to make a note of the auto-generated root password from this step.) The second command starts the MySQL service. The last command helps to improve the security of your running MySQL instance. Once enabled, the MySQL logs can be found in: /opt/local/var/log/mysql8 }} -要するに以下を実行する。最初にmy.cnfの設定か。sudoだとエラーがでたのでrootになってから実行した方が良いかも。 #pre{{ $ sudo /opt/local/lib/mysql8/bin/mysqld --initialize --user=_mysql $ sudo port load mysql8-server $ /opt/local/lib/mysql8/bin/mysql_secure_installation }} *設定 [#u11e42a8] **my.cnfの編集 [#q02c4031] -以下の内容におきかえ。デフォルトはネットワーク経由で接続できない設定なので注意。 #pre{{ # Use default MacPorts settings #!include /opt/local/etc/mysql8/macports-default.cnf [client] default-character-set=utf8mb4 [mysqld] basedir="/opt/local" character-set-server=utf8mb4 max_allowed_packet = 32M [mysqldump] default-character-set=utf8mb4 [mysql] default-character-set=utf8mb4 }}