[MacPorts] howto/MySQL modified

MacPorts noreply at macports.org
Sun Oct 9 04:39:58 CEST 2016


Page "howto/MySQL" was changed by billc_lists at greenbuilder.com
Diff URL: <https://trac.macports.org/wiki/howto/MySQL?action=diff&version=11>
Revision 11
Comment: Updated to include MySQL 5.7
Changes:
-------8<------8<------8<------8<------8<------8<------8<------8<--------
Index: howto/MySQL
=========================================================================
--- howto/MySQL (version: 10)
+++ howto/MySQL (version: 11)
@@ -13,7 +13,8 @@
 MacPorts includes several versions of MySQL and some of its forks. You can install any or all of these versions simultaneously, though it is expected that you will only need to install one of them.
 
 * MySQL
-  * '''mysql56''': MySQL v5.6.x. This is the latest stable version of MySQL.
+  * '''mysql57''': MySQL v5.7.x. This is the latest stable version of MySQL.
+  * '''mysql56''': MySQL v5.6.x.
   * '''mysql55''': MySQL v5.5.x.
   * '''mysql51''': MySQL v5.1.x. This version reached [https://www.mysql.com/support/eol-notice.html end of life] at the end of 2013 and is therefore no longer recommended.
 * MariaDB: a fork of MySQL created by the original MySQL developer after MySQL AB's acquisition by Sun Microsystems
@@ -31,12 +32,12 @@
 
 If you want to run a MySQL server on this computer, install MySQL like this:
 {{{
-$ sudo port install mysql56-server
+$ sudo port install mysql57-server
 }}}
 
 = Step 2: Create a database =
 
-Also, mysql56 now uses the `''port select''` mechanism to manage the creation of symlinks in 
+Also, mysql57 now uses the `''port select''` mechanism to manage the creation of symlinks in 
 /opt/local/bin. Using `port select` will install a link for exactly one of the available
 installations. Alternatively, you may simply add the path containing the desired mysql
 installation to your PATH.
@@ -44,46 +45,70 @@
 Use one of these two:
 
 {{{
-$ sudo port select mysql mysql56
+$ sudo port select mysql mysql57
 
-$ export PATH=$PATH:/opt/local/lib/mysql56/bin
+$ export PATH=$PATH:/opt/local/lib/mysql57/bin
 }}}
 
-Once you have done at least one of the two previous commands, set up the main database:
+Once you have done at least one of the two previous commands, set up the main database.  For MySQL 5.7:
+
+{{{
+$ sudo /opt/local/lib/mysql57/bin/mysqld --initialize --user=_mysql
+}}}
+
+Make a note of the root user password which is auto-generated.
+
+For MySQL 5.6 and earlier:
 
 {{{
 $ sudo -u _mysql mysql_install_db 
-$ sudo chown -R _mysql:_mysql /opt/local/var/db/mysql56/ 
-$ sudo chown -R _mysql:_mysql /opt/local/var/run/mysql56/ 
-$ sudo chown -R _mysql:_mysql /opt/local/var/log/mysql56/ 
+}}}
+
+(initial password is blank for MySQL 5.6 and earlier)
+
+Set the owner:
+
+{{{
+$ sudo chown -R _mysql:_mysql /opt/local/var/db/mysql57/ 
+$ sudo chown -R _mysql:_mysql /opt/local/var/run/mysql57/ 
+$ sudo chown -R _mysql:_mysql /opt/local/var/log/mysql57/ 
 }}}
 
 = Step 3: Activate the installation =
 Activate your MySQL server installation so that it autostarts when you boot your machine:
 {{{
-$ sudo port load mysql56-server
+$ sudo port load mysql57-server
 }}}
 
 and then verify that it is running:
 {{{
 $ ps -ax | grep mysql
 }}}
+
+If running, the command will return something like:
+
+{{{
+     /opt/local/bin/daemondo --label=mysql57-server --start-cmd /opt/local/lib/mysql57/bin/mysqld --user=_mysql ; --pid=exec
+     /opt/local/lib/mysql57/bin/mysqld --user=_mysql
+     grep mysql
+}}}
+
 = Step 4: Set the MySQL password =
-Set the MySQL `root` password (it should currently be empty, see also the security option below):
+Set the MySQL `root` password (use the auto-generated password from the --initialize command above for MySQL 5.7.  For MySQL 5.6 and earlier the password should currently be empty; see also the security option below):
 {{{
-$ /opt/local/lib/mysql56/bin/mysqladmin -u root -p password <new-password> 
+$ /opt/local/lib/mysql57/bin/mysqladmin -u root -p password <new-password> 
 }}}
 Note: This command line form of the command will generate: 
  ''Warning: Using a password on the command line interface can be insecure.''
 Therefore it is recommended that you use the interactive form:
 {{{
-$ /opt/local/lib/mysql56/bin/mysqladmin -u root -p password 
+$ /opt/local/lib/mysql57/bin/mysqladmin -u root -p password 
 }}}
  ''Enter password:'' <press return> \\
  ''New password:'' <new password> \\
  ''Confirm new password:'' <new password>
 
-You will first be prompted for your existing password (''Enter password:''); since it is empty, just press Return.\\
+You will first be prompted for your existing password (''Enter password:''); enter the root password (auto generated or no entry depending on your MySQL version) then press Return.\\
 Then  <new-password>`is your new desired root password, followed by Return.
 
 Test everything by logging in to the server.
@@ -125,7 +150,7 @@
 {{{
 -- HOW TO USE THIS FILE (with a MacPorts installation):
 
---$ sudo port unload mysql56-server
+--$ sudo port unload mysql57-server
 
 -- $ sudo mysqld_safe --init-file=mysql_security.sql &
 -- The init will terminate if there are any errors in the init file.
@@ -135,7 +160,7 @@
 -- Check that everything worked.  There may be an ERROR if the test database
 -- doesn't exist.  Otherwise there should be no errors in the file reported by
 -- 'mysqld_safe Logging to ..." during the mysql_safe5 startup from above:
--- $ sudo tail -n 20 /opt/local/var/db/mysql5/*.err 
+-- $ sudo tail -n 20 /opt/local/var/db/mysql5*.err 
 
 UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
 DELETE FROM mysql.user WHERE User='root' AND Host!='localhost';
@@ -147,7 +172,7 @@
 
 The server startup options {{{--skip-networking}}} and {{{--skip-grant-tables}}} may be useful while implementing security.  
 
-See also http://dev.mysql.com/doc/refman/5.6/en/resetting-permissions.html#resetting-permissions-unix
+See also http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html#resetting-permissions-unix
 
 
 = Step 6: Database upgrade as necessary = #mysql_upgrade
@@ -156,18 +181,18 @@
 
 {{{
 man mysql_upgrade  -- details on the upgrade program (man page)
-sudo port unload mysql56-server
-sudo /opt/local/lib/mysql56/bin/mysql_upgrade -u root -p
-sudo port load mysql56-server
+sudo port unload mysql57-server
+sudo /opt/local/lib/mysql57/bin/mysql_upgrade -u root -p
+sudo port load mysql57-server
 }}}
 == Starting and stopping the MySQL server ==
 === Start ===
 {{{ 
-$ sudo port load mysql56-server
+$ sudo port load mysql57-server
 }}}
 === Stop ===
 {{{ 
-$ sudo port unload mysql56-server
+$ sudo port unload mysql57-server
 }}}
 
 
-------8<------8<------8<------8<------8<------8<------8<------8<--------

--
Page URL: <https://trac.macports.org/wiki/howto/MySQL>
MacPorts <https://www.macports.org/>
Ports system for the Mac operating system

This is an automated message. Someone added your email address to be
notified of changes on 'howto/MySQL' page.
If it was not you, please report to .



More information about the macports-changes mailing list