hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Dedicated Server : MySQL on Raq4
Reply

Dedicated Server Current and past experiences with dedicated server providers, bandwidth, and server performance. Review managed and unmanaged dedicated web servers, discuss both Windows and Unix dedicated server solutions, and discuss dedicated hosting providers. If your service is unavailable, please click here.
Forum Jump

MySQL on Raq4

Reply Post New Thread In Dedicated Server Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 03-04-2002, 12:18 PM
Whitesell Whitesell is offline
Junior Guru Wannabe
 
Join Date: Feb 2002
Location: Dallas, TX USA
Posts: 68

MySQL on Raq4


Hi All,

I've got PHP4 and MySQL running on my Raq4 and am just beginning to try to use MySQL. I'm running into a problem connecting to the databases with PHP.

I'm sure there is an easy fix, but since I'm brand new to MySQL I haven't been able to figure it out yet. Here's what's happening:

I can log in and create databases and build tables via telnet. I installed phpMyAdmin and got it running, but I had to define the path to the socket in config.inc.php as follows:

$cfgServers[1]['socket'] = '/var/lib/mysql/mysql.sock';

Every time MySQL tries to connect to a database I get the following error:
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)

It's obvious PHP can't find the socket where it expects it. The question I have is How do I move the socket to the location that is expected by php? Or is there a way to define the path to the socket in PHP?

I'm really new to both PHP and MySql, so I'm afraid I'll probably need a clear step-by-step instruction in order for it to sink in to my thick skull!

Thanks in advance for your help!

Regards,

Jim

P.S. What would be a good beginner's book for PHP and MySQL??

Reply With Quote


Sponsored Links
  #2  
Old 03-04-2002, 01:26 PM
GideonX GideonX is offline
Web Hosting Master
 
Join Date: Dec 2001
Location: NYC
Posts: 1,902
why not just change this:

$cfgServers[1]['socket'] = '/var/lib/mysql/mysql.sock';

to

$cfgServers[1]['socket'] = '/tmp/mysql.sock';

err...hope that would work

edit - u may also wish to do a locate on your mysql.sock..

Reply With Quote
  #3  
Old 03-04-2002, 01:39 PM
Whitesell Whitesell is offline
Junior Guru Wannabe
 
Join Date: Feb 2002
Location: Dallas, TX USA
Posts: 68
Quote:
why not just change this:

$cfgServers[1]['socket'] = '/var/lib/mysql/mysql.sock';

to

$cfgServers[1]['socket'] = '/tmp/mysql.sock';
When I fist tried to run phpMyAdmin, I got the same error. The docs include this:

[QUOTE]First, you need to determine what socket is being used by MySQL.
To do this, telnet to your server and go to the MySQL bin directory. In this directory there should be a file named mysqladmin. Type ./mysqladmin variables, and this should give you a bunch of info about your MySQL server, including the socket (/tmp/mysql.sock, for example).

Then, you need to tell PHP to use this socket.
Assuming you are using PHP 3.0.10 or better, you can specify the socket to use when you open the connection. To do this in phpMyAdmin, you need to complete the socket information in the config.inc.php3.
[QUOTE]

When I looked at the variables per the above instructions, I found that it is using 'var/lib/mysql/mysql.sock', not '/tmp/mysql.sock', which is what PHP wants to use. So even though I've got phpMyAdmin working, other attempts to connect via php are failing becuse it is trying to find the socket at /tmp/mysql.sock.

Regards,

Jim Whitesell

Reply With Quote
Sponsored Links
  #4  
Old 03-04-2002, 01:46 PM
ctorrington ctorrington is offline
Newbie
 
Join Date: Feb 2002
Posts: 24
Out of interest, how did you install PHP and MySQL because i just compiled both of them and they just magically worked.

__________________
Christopher Torrington
christopher@simple-host.co.uk
Simple-Host

Reply With Quote
  #5  
Old 03-04-2002, 01:53 PM
Whitesell Whitesell is offline
Junior Guru Wannabe
 
Join Date: Feb 2002
Location: Dallas, TX USA
Posts: 68
They were both installed on the server when I got it. I've had the server a little over a year, but haven't tried to use MySql until now. I've got a couple of clients wanting to use it but I need to get this figured out first!

Regards,

Jim Whitesell

Reply With Quote
  #6  
Old 03-04-2002, 01:56 PM
ctorrington ctorrington is offline
Newbie
 
Join Date: Feb 2002
Posts: 24
I would suggest installing PHP again so that it can find mysql.

__________________
Christopher Torrington
christopher@simple-host.co.uk
Simple-Host

Reply With Quote
  #7  
Old 03-04-2002, 02:06 PM
Cephren Cephren is offline
Registered User
 
Join Date: Jun 2001
Posts: 596
manual way...

You'll need:

1. MySQL 3.23.37 pkg file
- http://pkg.nl.cobalt.com/i386/RaQ3-R...-3.23.37-1.pkg

2. PHP 4.06 source tarball
- http://www.php.net/do_download.php?d...te=www.php.net

3. PHPinfo config settings.
- Create a php file named phpinfo.php and place in it

<? phpinfo(); ?>

Load that up in your browser and look for the Configure command settings
i.e. http://yourdomain.com/phpinfo.php

Remove the single quotes and you'll find for Rackshack.net raq4i server like i have the following:


quote:
--------------------------------------------------------------------------------

./configure --prefix=/usr --with-apxs=/usr/sbin/apxs --with-gd --with-gettext=/usr --enable-safe-mode --with-config-file-path=/etc/httpd --with-exec-dir=/usr/bin --with-zlib --enable-magic-quotes --with-regex=system --with-ttf=/usr/lib/libttf.so --enable-track-vars --enable-xml --disable-debug --with-db3 --with-interbase=shared --with-pgsql=shared --with-ldap --with-imap
--------------------------------------------------------------------------------

Notice: that --with-mysql has not been compiled into php 4.03, you'll need to add this for php 4.06 (further below) as well as change --with-db3 to --with-db

Install MySQL
====================
1. Log into raq4 server admin page and go to ->Maintenance ->Install software

Enter the pkg file url at http://pkg.nl.cobalt.com/i386/RaQ3-R...-3.23.37-1.pkg
and hit install and wait for confirmation of install at the bottom frame of the page.

2. Now to change the mysql root password to secure your mysql server
- log in telnet
- switch to root user

su -

- type

mysqladmin -uroot -pcobalt-mysql password NEW-PASSWORD


Upgrade PHP 4.03 to PHP 4.06 (with mysql support)
=========================================================
This will upgrade PHP 4.03 to PHP 4.06 with mysql support.

1. telnet into your server
2. switch to root user

su -

3. change to /usr/local/src directory

cd /usr/local/src

4. Download php 4.0.6 source tarball:

wget http://www.php.net/do_download.php?d...te=www.php.net

5. extract tarball

tar xfz php-4.0.6.tar.gz

6. change to php-4.0.6 directory

cd php-4.0.6

7. Copy and paste this new configure command line. Get the configure command line from above in phpinfo.php page and you'll need to add --with-mysql as well as change --with-db3 to --with-db so it looks like (i use a text file to hold this configure command so i can copy and paste it):


quote:
--------------------------------------------------------------------------------

./configure --prefix=/usr --with-mysql --with-apxs=/usr/sbin/apxs --with-gd --with-gettext=/usr --enable-safe-mode --with-config-file-path=/etc/httpd --with-exec-dir=/usr/bin --with-zlib --enable-magic-quotes --with-regex=system --with-ttf=/usr/lib/libttf.so --enable-track-vars --enable-xml --disable-debug --with-db --with-interbase=shared --with-pgsql=shared --with-ldap --with-imap
--------------------------------------------------------------------------------

8. type

make

9. now backup the .so files that are currently in use


mkdir backup_so

mkdir backup_so/php

cp /etc/httpd/modules/libphp4.so ./backup_so/

cp /etc/httpd/modules/php/* ./backup_so/php/


10. type

make install

11. restart apache

/etc/rc.d/init.d/httpd stop
/etc/rc.d/init.d/httpd start

12. check your http://yourdomain.com/phpinfo.php you should have PHP 4.06

Reply With Quote
  #8  
Old 03-04-2002, 02:27 PM
blacknight blacknight is offline
Web Hosting Master
 
Join Date: Mar 2001
Location: Ireland
Posts: 1,354
Wouldn't it be easier for him to install everything using the latest packages?
There's also a very nice package version of PhPMyAdmin available from Cobalt World

Reply With Quote
  #9  
Old 03-04-2002, 02:54 PM
ctorrington ctorrington is offline
Newbie
 
Join Date: Feb 2002
Posts: 24
Yes, as far as I can see just by looking at it, the above steps are sound. But just use PHP 4.1.2 instead of 4.0.6

__________________
Christopher Torrington
christopher@simple-host.co.uk
Simple-Host

Reply With Quote
  #10  
Old 03-04-2002, 04:23 PM
Whitesell Whitesell is offline
Junior Guru Wannabe
 
Join Date: Feb 2002
Location: Dallas, TX USA
Posts: 68
Thanks, guys, for your help!

After re-installing both, php is now able to connect with MySQL!

By the way, the cobalt pkg site has been shut down. They have spun the site off to:

http://pkgmaster.com

Reply With Quote
  #11  
Old 03-05-2002, 11:14 PM
dlyles dlyles is offline
Newbie
 
Join Date: Jun 2001
Location: Maryland
Posts: 24
Ok, I need to jump in here because I'm having a 'similar' problem. I'm getting the message "Error 2002 can't connect to MySQL server through socket /var/lib/mysql/mysql.sock"

I don't know what to do to fix this problem. The problem started when I did two things - 1 - I removed a .pid file (don't know what that is) and 2- upgraded to ChiliASP 3.6. Before that, I was able to connect. Any help or even a place to go for the answer would be GREATLY appreciated.

__________________
D. Lyles
Uniquest Designs

Reply With Quote
  #12  
Old 03-06-2002, 01:02 AM
Whitesell Whitesell is offline
Junior Guru Wannabe
 
Join Date: Feb 2002
Location: Dallas, TX USA
Posts: 68
Hi dlyles,

Are you having this problem with PHP? If so, you can check to see what socket PHP is using by doing the following:

1. Create a file called phpinfo.php. This file only needs one line in it:

<? phpinfo(); ?>

2. Upload that file to your server and look at in in your browser:

http://www.yourdomain.com/phpinfo.php

3. It'll print out a bunch of details Under 'mysql' you'll see if support is enabled. look for the entry 'MYSQL_SOCKET' and check to see what the value is.

In my case, it was wrong. Re-installing mysql did the trick for me.

Hope this helps,

Jim Whitesell

Reply With Quote
  #13  
Old 03-06-2002, 01:17 AM
dlyles dlyles is offline
Newbie
 
Join Date: Jun 2001
Location: Maryland
Posts: 24
I'm not using PHP. Thanks for the input anyway. I did try reinstalling and reinstalling again, but that didn't work.

__________________
D. Lyles
Uniquest Designs

Reply With Quote
  #14  
Old 03-07-2002, 08:37 PM
jahsh jahsh is offline
Web Hosting Guru
 
Join Date: Oct 2001
Location: san diego
Posts: 256
all you need to do is make a soft link:
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
and that should fix your problem.

Reply With Quote
  #15  
Old 04-12-2002, 04:25 PM
nolittle nolittle is offline
Newbie
 
Join Date: Apr 2002
Posts: 17
This may be a bit late. I have just joined this forum. I am also learning PHP and MySQL.

Re a book recommendation. I have found "PHP and MySQL Web Development" by sams to be quite good

Alan

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Web Host Rackspace Launches Private Beta for MySQL Cloud Database Web Hosting News 2011-12-01 21:09:51
Parallels Now Offering Licenses for CloudLinux OS Web Hosting News 2011-10-26 17:29:25
Web Hosting Sales and Promos Roundup - October 7, 2011 Web Hosting News 2011-10-07 19:56:18
Web Hosting Software Firm CloudLinux Releases CloudLinux OS Version 6.1 Web Hosting News 2011-09-13 14:08:49
Web Host FireHost Partners with Cloud Security Firm Gazzang for Data Encryption Web Hosting News 2011-08-16 20:33:43


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?