MySQL Socket error

Hey guys,

I’ve been working on setting up a LAMP (Linux, Apache, MySQL and PHP) server on OpenSUSE 11.1, and I’ve run into a reoccurring issue with the path for the MySQL socket. I’ve been using the following tutorial on the OpenSUSE website to setup the server because I’m not familiar with the configuration of the server: click here. The section that I’ve been having particular trouble with is the Configuring mySQL section; everything previous to that point is working fine and went over without a hitch. When I start PHPMyAdmin and try to login with the username root and the password I set during installation, and I get the following error:

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

Here is the package information for the MySQL package:

zypper info mysql

Information for package mysql:

Repository: @System
Name: mysql
Version: 5.1.34-30.1
Arch: i586
Vendor: openSUSE Build Service
Installed: Yes
Status: up-to-date
Installed Size: 25.5 M
Summary: A True Multiuser, Multithreaded SQL Database Server

And the package information for PHPMyAdmin:

zypper info phpmyadmin

Information for package phpmyadmin:

Repository: @System
Name: phpMyAdmin
Version: 3.1.5-1.1
Arch: noarch
Vendor: openSUSE Build Service
Installed: Yes
Status: up-to-date
Installed Size: 10.8 M
Summary: Administration of MySQL over the web

The following is the system information for my OpenSUSE system:

uname -a

Linux linux-gdii 2.6.27.23-0.1-pae #1 SMP 2009-05-26 17:02:05 -0400 i686 i686 i386 GNU/Linux

And lastly, the MySQL log under /var/log:

cat /var/log/mysqld.log

090621 21:40:16 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
090621 21:40:16 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait…
090621 21:40:16 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait…
090621 21:40:16 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait…
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
090621 21:40:17 InnoDB: Started; log sequence number 0 0
090621 21:40:17 [Note] Event Scheduler: Loaded 0 events
090621 21:40:17 [Note] /usr/sbin/mysqld: ready for connections.
Version: ‘5.1.34-log’ socket: ‘/var/lib/mysql/mysql.sock’ port: 3306 SUSE MySQL RPM
090621 21:53:16 mysqld_safe A mysqld process already exists
090621 22:20:48 [Note] /usr/sbin/mysqld: Normal shutdown

090621 22:20:48 [Note] Event Scheduler: Purging the queue. 0 events
090621 22:20:48 InnoDB: Starting shutdown…
090621 22:20:49 InnoDB: Shutdown completed; log sequence number 0 46409
090621 22:20:49 [Warning] Forcing shutdown of 1 plugins
090621 22:20:49 [Note] /usr/sbin/mysqld: Shutdown complete

090621 22:20:49 mysqld_safe mysqld from pid file /var/run/mysql/mysqld.pid ended
090622 08:59:44 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
090622 8:59:45 InnoDB: Started; log sequence number 0 46409
090622 8:59:46 [Note] Event Scheduler: Loaded 0 events
090622 8:59:46 [Note] /usr/sbin/mysqld: ready for connections.
Version: ‘5.1.34-log’ socket: ‘/var/lib/mysql/mysql.sock’ port: 3306 SUSE MySQL RPM

The last line in the log caught my attention, but I’m not sure what to do with it.

Thank you in advance for the help! :slight_smile:

Like many people, you enabled as much repos as possible. And updated mySQL from 5 to 5.1
Now path- and fileconventions have changed the places where the MySQL config files are, therefor the error.
Start the software installer, remove the repo, search for mySQL, update all unconditionally, and you’re back to mySQL 5. Reboot to make sure all services are restarted. Should be working now; I can reproduce the whole thing and fix it.

Please let us know how you got on.

REMARK: It is clearly stated on opensuse.org that the packages from the Database repo are experimental.

Okay, I removed the Database repository and downgraded the MySQL package, and something has changed, but I’m not sure if it’s the fix. I still get the “It works!” message when I view the server on my system (http://127.0.0.1/), but when I go to http://127.0.0.1/~username, it shows the directory and the files, but does not display the files as the main page. For example, I have an index.php, but it does not become the homepage. When I click on the link for the file under the directory, it asks me to download the file, and that’s the only option I can do. On the same note, when I visit http://127.0.0.1/phpMyAdmin/, I get the message “Access forbidden!” and the following information also accompanies this warning:

Access forbidden!

You don’t have permission to access the requested directory. There is either no index document or the directory is read-protected.

If you think this is a server error, please contact the webmaster.

Error 403
127.0.0.1
Mon Jun 22 10:30:00 2009
Apache/2.2.10 (Linux/SUSE)

And the package information for the MySQL package is now:

zypper info mysql

Information for package mysql:

Repository: @System
Name: mysql
Version: 5.0.67-12.11
Arch: i586
Vendor: openSUSE
Installed: Yes
Status: up-to-date
Installed Size: 21.7 M
Summary: A True Multiuser, Multithreaded SQL Database Server

Just to test the idea, I changed the permissions of both the index.php file and the public_html directory to 777 to see if this would solve the problem. The issue still persists, even when I change the permissions to 777.

I’m sort of out of ideas because I am not familiar with the setting up of a server.

Thanks again for your help. :slight_smile:

As u installed LAMP, i don’t think, there should be a problem.
But after installing, you have to start all services manually.

/etc/init.d/apache2 start
/etc/init.d/mysql start

You can set all these from YAST, to start these services after each reboot.
About forbidden issue. Are you sure, you are accessing the right web server path?

I started each of the services through YaST through System Services and set each of the services to automatically start on boot through the same window. Just to be sure, I restarted each of the services through the snippets of code that you provided and Apache2 was already running and MySQL restarted and I rebooted. Still the problem persists where I am forbidden from viewing PHPMyAdmin and the directory displays the list of files in the public_html directory. The reason I know I have the correct path to the local server (the server I’m setting up on my system now using LAMP) is because when I view http://127.0.0.1/, I get a single message of “It works!” which means that the server itself is setup. The other reason I know I have the correct path is because when I tried the same path yesterday, I was able to see the content of the index.php file displayed (the only contents of the file where <?php phpinfo(); ?> so I was able to see the table of the PHP information). So, basically, the problem still persists.

(Thank you, though :slight_smile: )

So yesterday it was working, but today got problem. Did you reinstall the server b4 the problem. If you are getting open dialog box for php files, it is in most cases, that php apache mod is not installed or maybe not configured.
What you can do is:
1- Look for php-apache-module in yast2.
if above didnot work then try this.
2- Try to enable the php5 module in the Apache config. If you look in the file /etc/sysconfig/apache2 and the setting APACHE_MODULES doesn’t have php5 in the list, you have not enabled PHP.

Try it and let us know.

Well, I wanted to see if a complete reinstall would work, and it has.

I used a combination of the following two tutorials:

And it works like clockwork, now.

Thank you very much for your help! :slight_smile: