MySQL5 install stuff
Ryan Schmidt
ryandesign at macports.org
Mon Jun 25 14:51:23 PDT 2007
On Jun 25, 2007, at 15:28, paul beard wrote:
> I have to say that installing and running MySQL has never been
> troublefree
> for me.
>
> I find it especially frustrating when presented instructions to
> copy and
> paste that don't work:
>
> [/opt/local]# bin/mysql_install_db5
>
> Installing MySQL system tables...
>
> OK
>
> Filling help tables...
>
> OK
>
>
> To start mysqld at boot time you have to copy
>
> support-files/mysql.server to the right place for your system
Bear in mind that these instructions you are seeing from
mysql_install_db5 are generic instructions the MySQL team thinks will
be useful. This instruction to copy the mysql.server script is, of
course, useless for Mac OS X, where we provide a launchctl plist
instead. Perhaps we could patch the script to provide MacPorts-
specific instructions.
> PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
>
> To do so, start the server, then issue the following commands:
Ok, so it said right there that you need to start the server first.
> /opt/local/lib/mysql5/bin/mysqladmin -u root password 'new-password'
>
> /opt/local/lib/mysql5/bin/mysqladmin -u root -h white.paulbeard.org
> password
> 'new-password'
>
> See the manual for more instructions.
>
> You can start the MySQL daemon with:
>
> cd /opt/local ; /opt/local/lib/mysql5/bin/mysqld_safe &
>
>
> You can test the MySQL daemon with mysql-test-run.pl
>
> cd mysql-test ; perl mysql-test-run.pl
>
>
> Please report any problems with the /opt/local/lib/mysql5/bin/mysqlbug
> script!
>
>
> The latest information about MySQL is available on the web at
>
> http://www.mysql.com
>
> Support MySQL by buying support/licenses at http://shop.mysql.com
>
> (root at white.paulbeard.org)-(01:23 PM / Mon Jun 25)
>
> [/opt/local]# /opt/local/lib/mysql5/bin/mysqladmin -u root password
> 'new-password'
>
> /opt/local/lib/mysql5/bin/mysqladmin: connect to server at 'localhost'
> failed
>
> error: 'Can't connect to local MySQL server through socket
> '/opt/local/var/run/mysql5/mysqld.sock' (2)'
>
> Check that mysqld is running and that the socket:
> '/opt/local/var/run/mysql5/mysqld.sock' exists!
>
>
> It strikes me as obvious that the database server/daemon needs to
> be running
> before we'll be able to run commands against it, right? So how is that
> supposed to work?
So, like it said, you need to start the server before you can install
the initial databases. The port prints instructions for starting the
server when it's done installing, so long as you used the +server
variant, as I said before. The instructions would tell you to run
this command to start mysql5 now and to have it start at every
subsequent system startup:
sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
The opposite -- stopping mysql5 now and having it no longer start at
system startup -- would be:
sudo launchctl unload -w /Library/LaunchDaemons/
org.macports.mysql5.plist
> I knew there is some other incantation that runs it with the
> privileges
> opened up (something to do with grant tables) that I have used
> before but
> only after looking it up. I'm sure I can get it working -- I have done
> before -- but are people using these instructions and getting
> anywhere? I
> don't even see a reference to running the database installer, and
> without
> that you're hosed.
You mean, you don't see instructions advising you to run
mysql_install_db? Those instructions are also only printed if you use
the +server variant. If you do not use the +server variant of mysql5,
it is assumed that you merely want to use mysql to connect to a mysql
server already running on a different computer. If you want to run a
mysql server on this computer, you want +server.
The option to start the mysql server without its privilege system is
--skip-grant-tables but I don't think there's any reason why you
would need to use that.
More information about the macports-users
mailing list