Changes between Version 35 and Version 36 of howto/MySQL
- Timestamp:
- Mar 26, 2020, 1:17:55 PM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
howto/MySQL
v35 v36 14 14 15 15 * 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. 17 18 * '''mysql56''': MySQL v5.6.x. Support ended Feb 2018 18 19 * '''mysql55''': MySQL v5.5.x. Support ended Dec 2015. … … 37 38 If you want to run a MySQL server on this computer, install MySQL like this: 38 39 {{{ 39 $ sudo port install mysql 57-server40 $ sudo port install mysql8-server 40 41 }}} 41 42 … … 44 45 45 46 {{{ 46 $ sudo port select mysql mysql 5747 $ sudo port select mysql mysql8 47 48 }}} 48 49 … … 52 53 53 54 54 **For MySQL 5.7 :**55 56 {{{ 57 $ sudo /opt/local/lib/mysql 57/bin/mysqld --initialize --user=_mysql55 **For MySQL 5.7 and newer** 56 57 {{{ 58 $ sudo /opt/local/lib/mysql8/bin/mysqld --initialize --user=_mysql 58 59 }}} 59 60 … … 71 72 72 73 {{{ 73 $ sudo chown -R _mysql:_mysql /opt/local/var/db/mysql 57/74 $ sudo chown -R _mysql:_mysql /opt/local/var/run/mysql 57/75 $ sudo chown -R _mysql:_mysql /opt/local/var/log/mysql 57/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/ 76 77 }}} 77 78 … … 80 81 Activate your MySQL server so that it autostarts when you boot your machine: 81 82 {{{ 82 $ sudo port load mysql 57-server83 $ sudo port load mysql8-server 83 84 }}} 84 85 … … 91 92 92 93 {{{ 93 /opt/local/bin/daemondo --label=mysql 57-server --start-cmd /opt/local/lib/mysql57/bin/mysqld --user=_mysql ; --pid=exec94 /opt/local/lib/mysql 57/bin/mysqld --user=_mysql94 /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 95 96 grep mysql 96 97 }}} … … 101 102 102 103 {{{ 103 $ /opt/local/lib/mysql 57/bin/mysqladmin -u root -p password104 $ /opt/local/lib/mysql8/bin/mysqladmin -u root -p password 104 105 }}} 105 106 … … 153 154 {{{ 154 155 man mysql_upgrade -- details on the upgrade program (man page) 155 sudo port unload mysql 57-server156 sudo /opt/local/lib/mysql 57/bin/mysql_upgrade -u root -p157 sudo port load mysql 57-server156 sudo port unload mysql8-server 157 sudo /opt/local/lib/mysql8/bin/mysql_upgrade -u root -p 158 sudo port load mysql8-server 158 159 }}} 159 160 160 161 == Configuration my.cnf == 161 162 162 /opt/local/etc/mysql 57/my.cnf is a good place to customize your mysql57installation.163 164 On activation if no /opt/local/etc/mysql 57/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 165 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. 165 166 166 167 167 Any changes made to /opt/local/etc/mysql 57/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.168 Any 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. 168 169 169 170 == Starting and stopping the MySQL server == 170 171 === Start === 171 172 {{{ 172 $ sudo port load mysql 57-server173 $ sudo port load mysql8-server 173 174 }}} 174 175 === Stop === 175 176 {{{ 176 $ sudo port unload mysql 57-server177 $ sudo port unload mysql8-server 177 178 }}} 178 179 … … 197 198 e.g. 198 199 {{{ 199 phobos:org.macports.mysql 57-server wf$ls -l /opt/local/var/db/mysql57200 phobos:org.macports.mysql8-server wf$ls -l /opt/local/var/db/mysql8 200 201 total 221200 201 202 -rw-r----- 1 _mysql _mysql 56 31 Mär 09:17 auto.cnf … … 209 210 == initialize fails == 210 211 {{{ 211 sudo -u mysql /opt/local/lib/mysql 57/bin/mysqld --initialize --user=_mysql212 sudo -u mysql /opt/local/lib/mysql8/bin/mysqld --initialize --user=_mysql 212 213 2018-04-08T06:52:45.557302Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting. 213 214 2018-04-08T06:52:45.557337Z 0 [ERROR] Aborting … … 216 217 e.g. 217 218 {{{ 218 rm /opt/local/var/db/mysql 57/*219 rm /opt/local/var/db/mysql8/* 219 220 }}} 220 221 and then rerun the mysqld initialize command. … … 234 235 {{{ 235 236 grep mysql /var/log/system.log 236 Apr 8 08:26:11 phobos com.apple.xpc.launchd[1] (org.macports.mysql 57-server[2262]): Service exited with abnormal code: 1237 Apr 8 08:26:11 phobos com.apple.xpc.launchd[1] (org.macports.mysql 57-server): Service only ran for 2 seconds. Pushing respawn out by 8 seconds.237 Apr 8 08:26:11 phobos com.apple.xpc.launchd[1] (org.macports.mysql8-server[2262]): Service exited with abnormal code: 1 238 Apr 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. 238 239 }}} 239 240 The 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: … … 250 251 251 252 {{{ 252 sudo /opt/local/lib/mysql 57/bin/mysql_upgrade -u root -p253 sudo /opt/local/lib/mysql8/bin/mysql_upgrade -u root -p 253 254 Enter password: 254 mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/opt/local/var/run/mysql 57/mysqld.sock' (2) while connecting to the MySQL server255 mysql_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 255 256 Upgrade process encountered error and will not continue. 256 257 }}}