Apache and MySQL won't start

Ryan Schmidt ryandesign at macports.org
Wed Jul 28 09:51:00 PDT 2010


On Jul 28, 2010, at 11:34, Ali A Samii wrote:

> OK, so stopped apache2, sudo port load apache2
> This is what echoed back:
> 
> sudo port load apache2
> Error: Target org.macports.load returned: org.macports.apache2: Already loaded
> Log for apache2 is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_apache2/main.log
> Error: Status 1 encountered during processing.
> To report a bug, see <http://guide.macports.org/#project.tickets>

Ok, so unload it and try again.

sudo port unload apache2


> Re mysql, lots of problems
> 
> When I reinstalled it via the shell command line, it seemed to install properly. But then I tried create the initial databases using:
> 	sudo /opt/local/lib/mysql5/bin/mysql_install_db --user=mysql 
> 
> I got no end of errors.
> 
> It couldn't make several directories, such as /opt/local/var/db/ and /opt/local/var/db/mysql5

These directories should have been created for you. Did you install the mysql5-server port? If not, you'll want to do that. "sudo port load mysql5-server" is also the usual way you'd start the server, though that assumes you've already created the databases.


> and it couldn't build the initial databases.

What error occurred? This is probably key to getting MySQL started, which is a prerequisite for everything else you tried below.


> So I issued an su and logged in as root, and there, I was successful to do it. Makes no sense to me because I issued the previous command using sudo.
> 
> Logged out as root, and tried to confirm mysql is running using mysqladmin5 -u root -p ping
> 
> I got no response, No error, no nothing.
> 
> mysql does not show up in ps auxw | grep mysql
> 
> then I issued a "mysql5 -u root -p" which echoed the following error:
> 
> ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)
> 
> I then created a file "/opt/local/etc/mysql5/my.cnf" and put in it the following line: "[mysqld_safe] socket = /tmp/mysql.sock"
> 
> Retried, and I got the same ERROR 2002.

If possible, you should avoid putting the MySQL socket in /tmp; it's a potential security risk. You should leave the socket where MacPorts suggested, in /opt/local/var/run/mysql5.


> So gave up on that, tried setting the password using "mysqladmin5 -u root password" and the echo was:
> 
> 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
> 
> And there I stand!





More information about the macports-users mailing list