[MacPorts] howto/MySQL modified

MacPorts Wiki noreply at macports.org
Sat May 18 22:31:15 UTC 2019


Page "howto/MySQL" was changed by gagarine
Diff URL: <https://trac.macports.org/wiki/howto/MySQL?action=diff&version=31>
Revision 31
Changes:
-------8<------8<------8<------8<------8<------8<------8<------8<--------
Index: howto/MySQL
=========================================================================
--- howto/MySQL (version: 30)
+++ howto/MySQL (version: 31)
@@ -37,22 +37,19 @@
 $ sudo port install mysql57-server
 }}}
 
+
+Select the installed version to be the default one
+
+{{{
+$ sudo port select mysql mysql57
+}}}
+
+
+
 == Step 2: Create a database ==
 
-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.
-
-Use one of these two:
-
-{{{
-$ sudo port select mysql mysql57
-
-$ 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.  For MySQL 5.7:
+
+**For MySQL 5.7:**
 
 {{{
 $ sudo /opt/local/lib/mysql57/bin/mysqld --initialize --user=_mysql
@@ -60,7 +57,7 @@
 
 Make a note of the root user password which is auto-generated.
 
-For MySQL 5.6 and earlier:
+**For MySQL 5.6 and earlier:**
 
 {{{
 $ sudo -u _mysql mysql_install_db 
@@ -76,8 +73,9 @@
 $ 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:
+== Step 3: Start MySQL ==
+
+Activate your MySQL server so that it autostarts when you boot your machine:
 {{{
 $ sudo port load mysql57-server
 }}}
@@ -96,16 +94,19 @@
 }}}
 
 == Step 4: Set the MySQL password ==
+
 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/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/mysql57/bin/mysqladmin -u root -p password 
 }}}
+
  ''Enter password:'' <press return> \\
  ''New password:'' <new password> \\
  ''Confirm new password:'' <new password>
@@ -145,34 +146,6 @@
 $ /opt/local/bin/mysql_secure_installation
 }}}
 
-The following is a more detailed process that may achieve the same results as the interactive program.  Place the following into {{{mysql_security.sql}}} and replace the {{{'MyNewPass'}}} with your root password.  Note that the SQL will remove all access for root from any location other than 'localhost'.  You might like to keep this SQL file - all the lines beginning with '--' are doc-comments about how to use it.
-
-Wrapper no longer exists...
-
-{{{
--- HOW TO USE THIS FILE (with a MacPorts installation):
-
---$ 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.
--- Wait a bit to be sure the server is running.
--- If it's running, then shutdown the server (root password required):
--- $ /opt/local/bin/mysqladmin -u root -p shutdown
--- 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 
-
-UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
-DELETE FROM mysql.user WHERE User='root' AND Host!='localhost';
-DELETE FROM mysql.user WHERE User='';
-FLUSH PRIVILEGES;
-DROP DATABASE test;
-DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';
-}}}
-
-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.7/en/resetting-permissions.html#resetting-permissions-unix
 
@@ -187,6 +160,7 @@
 sudo /opt/local/lib/mysql57/bin/mysql_upgrade -u root -p
 sudo port load mysql57-server
 }}}
+
 == Starting and stopping the MySQL server ==
 === Start ===
 {{{ 
@@ -196,11 +170,14 @@
 {{{ 
 $ sudo port unload mysql57-server
 }}}
+
 = Troubleshooting =
 see e.g. https://lists.macports.org/pipermail/macports-users/2016-July/041178.html
+
 == Where are ... ==
 see e.g.
 * https://stackoverflow.com/questions/7459103/mysql-data-directory-location
+
 === Libraries and socket files ===
 The command
 {{{
-------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 macOS

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 admin at macports.org.


More information about the macports-changes mailing list