After installing mysql51 and mysql51-server using macports, we need to make it secure by running /local/lib/mysql51/bin/mysql_secure_installation. But before that, as default installation does not set root password, root password should be set first:

$ mysql -uroot
mysql> use mysql;
mysql> update user set password=password('your_password') where user='root';
mysql> flush privileges;

And then run mysql_secure_installation.

Here’s how to start and stop mysql:

alias mysqlstart='sudo /opt/local/lib/mysql51/bin/mysqld_safe'
alias mysqlstop='sudo /opt/local/share/mysql51/mysql/mysql.server stop'

‘mysqlstop’ needs you to enter mysql root’s password. If that’s annoying, unset root password:

mysql> update user set password='' where user='root';
mysql> flush privileges;

Read the output of ‘mysqlstart’ to find log file location. In the log, there’s socket file location. To change it, modify /opt/local/etc/mysql51/my.cnf:

# Use default MacPorts settings
!include /opt/local/etc/mysql51/macports-default.cnf



Similar Posts:

Post a Comment

Your email is never published nor shared.