Changes between Version 35 and Version 36 of howto/MySQL


Ignore:
Timestamp:
Mar 26, 2020, 1:17:55 PM (5 years ago)
Author:
haraldgroven (Harald)
Comment:

MySQL8 is GA since 2019-04, please verify this with clean install

Legend:

Unmodified
Added
Removed
Modified
  • howto/MySQL

    v35 v36  
    1414
    1515* MySQL
    16   * '''mysql57''': MySQL v5.7.x. This is the latest stable version of MySQL. Support ends Oct 2020.
     16  * '''mysql8''': MySQL v8.x. This is the latest stable version of MySQL made General Available in 2019-04-19
     17  * '''mysql57''': MySQL v5.7.x. Support ends Oct 2020.
    1718  * '''mysql56''': MySQL v5.6.x. Support ended Feb 2018
    1819  * '''mysql55''': MySQL v5.5.x. Support ended Dec 2015.
     
    3738If you want to run a MySQL server on this computer, install MySQL like this:
    3839{{{
    39 $ sudo port install mysql57-server
     40$ sudo port install mysql8-server
    4041}}}
    4142
     
    4445
    4546{{{
    46 $ sudo port select mysql mysql57
     47$ sudo port select mysql mysql8
    4748}}}
    4849
     
    5253
    5354
    54 **For MySQL 5.7:**
    55 
    56 {{{
    57 $ sudo /opt/local/lib/mysql57/bin/mysqld --initialize --user=_mysql
     55**For MySQL 5.7 and newer**
     56
     57{{{
     58$ sudo /opt/local/lib/mysql8/bin/mysqld --initialize --user=_mysql
    5859}}}
    5960
     
    7172
    7273{{{
    73 $ sudo chown -R _mysql:_mysql /opt/local/var/db/mysql57/
    74 $ sudo chown -R _mysql:_mysql /opt/local/var/run/mysql57/
    75 $ sudo chown -R _mysql:_mysql /opt/local/var/log/mysql57/
     74$ sudo chown -R _mysql:_mysql /opt/local/var/db/mysql8/
     75$ sudo chown -R _mysql:_mysql /opt/local/var/run/mysql8/
     76$ sudo chown -R _mysql:_mysql /opt/local/var/log/mysql8/
    7677}}}
    7778
     
    8081Activate your MySQL server so that it autostarts when you boot your machine:
    8182{{{
    82 $ sudo port load mysql57-server
     83$ sudo port load mysql8-server
    8384}}}
    8485
     
    9192
    9293{{{
    93      /opt/local/bin/daemondo --label=mysql57-server --start-cmd /opt/local/lib/mysql57/bin/mysqld --user=_mysql ; --pid=exec
    94      /opt/local/lib/mysql57/bin/mysqld --user=_mysql
     94     /opt/local/bin/daemondo --label=mysql8-server --start-cmd /opt/local/lib/mysql8/bin/mysqld --user=_mysql ; --pid=exec
     95     /opt/local/lib/mysql8/bin/mysqld --user=_mysql
    9596     grep mysql
    9697}}}
     
    101102
    102103{{{
    103 $ /opt/local/lib/mysql57/bin/mysqladmin -u root -p password
     104$ /opt/local/lib/mysql8/bin/mysqladmin -u root -p password
    104105}}}
    105106
     
    153154{{{
    154155man mysql_upgrade  -- details on the upgrade program (man page)
    155 sudo port unload mysql57-server
    156 sudo /opt/local/lib/mysql57/bin/mysql_upgrade -u root -p
    157 sudo port load mysql57-server
     156sudo port unload mysql8-server
     157sudo /opt/local/lib/mysql8/bin/mysql_upgrade -u root -p
     158sudo port load mysql8-server
    158159}}}
    159160
    160161== Configuration my.cnf ==
    161162
    162 /opt/local/etc/mysql57/my.cnf is a good place to customize your mysql57 installation.
    163 
    164 On activation if no /opt/local/etc/mysql57/my.cnf file exists one will be created which loads /opt/local/etc/mysql57/macports-default.cnf.
     163/opt/local/etc/mysql8/my.cnf is a good place to customize your mysql8 installation.
     164
     165On activation if no /opt/local/etc/mysql8/my.cnf file exists one will be created which loads /opt/local/etc/mysql8/macports-default.cnf.
    165166   
    166167
    167 Any changes made to /opt/local/etc/mysql57/macports-default.cnf will be lost during port upgrades, deactivations or activations. Currently /opt/local/etc/mysql57/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.
     168Any changes made to /opt/local/etc/mysql8/macports-default.cnf will be lost during port upgrades, deactivations or activations. 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.
    168169
    169170== Starting and stopping the MySQL server ==
    170171=== Start ===
    171172{{{
    172 $ sudo port load mysql57-server
     173$ sudo port load mysql8-server
    173174}}}
    174175=== Stop ===
    175176{{{
    176 $ sudo port unload mysql57-server
     177$ sudo port unload mysql8-server
    177178}}}
    178179
     
    197198e.g.
    198199{{{
    199 phobos:org.macports.mysql57-server wf$ls -l /opt/local/var/db/mysql57
     200phobos:org.macports.mysql8-server wf$ls -l /opt/local/var/db/mysql8
    200201total 221200
    201202-rw-r-----  1 _mysql  _mysql        56 31 Mär 09:17 auto.cnf
     
    209210== initialize fails ==
    210211{{{
    211 sudo -u mysql /opt/local/lib/mysql57/bin/mysqld --initialize --user=_mysql
     212sudo -u mysql /opt/local/lib/mysql8/bin/mysqld --initialize --user=_mysql
    2122132018-04-08T06:52:45.557302Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
    2132142018-04-08T06:52:45.557337Z 0 [ERROR] Aborting
     
    216217e.g.
    217218{{{
    218 rm /opt/local/var/db/mysql57/*
     219rm /opt/local/var/db/mysql8/*
    219220}}}
    220221and then rerun the mysqld initialize command.
     
    234235{{{
    235236grep mysql /var/log/system.log
    236 Apr  8 08:26:11 phobos com.apple.xpc.launchd[1] (org.macports.mysql57-server[2262]): Service exited with abnormal code: 1
    237 Apr  8 08:26:11 phobos com.apple.xpc.launchd[1] (org.macports.mysql57-server): Service only ran for 2 seconds. Pushing respawn out by 8 seconds.
     237Apr  8 08:26:11 phobos com.apple.xpc.launchd[1] (org.macports.mysql8-server[2262]): Service exited with abnormal code: 1
     238Apr  8 08:26:11 phobos com.apple.xpc.launchd[1] (org.macports.mysql8-server): Service only ran for 2 seconds. Pushing respawn out by 8 seconds.
    238239}}}
    239240The following stackoverflow question has an answer that shows how you can modify the corresponding plist to give you the stderr output of the mysql server daemon:
     
    250251
    251252{{{
    252 sudo /opt/local/lib/mysql57/bin/mysql_upgrade -u root -p
     253sudo /opt/local/lib/mysql8/bin/mysql_upgrade -u root -p
    253254Enter password:
    254 mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/opt/local/var/run/mysql57/mysqld.sock' (2) while connecting to the MySQL server
     255mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/opt/local/var/run/mysql8/mysqld.sock' (2) while connecting to the MySQL server
    255256Upgrade process encountered error and will not continue.
    256257}}}