LinuxQuestions.org
Support LQ: Use code LQCO20 and save 20% on CrossOver Office
Go Back   LinuxQuestions.org > Forums > Linux > Linux - General
User Name
Password
Linux - General This forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Thread Tools
Old 04-05-2003, 09:05 AM   #1
cuboctahedron
Member
 
Registered: Nov 2002
Posts: 70
Thanked: 0
mysql and mandrake 9.1


[Log in to get rid of this advertisement]
Hi,
I installed mandrake 9.1 and want to setup a webserver. Mysql starts as a service, but whenever I am trying to connect I get an error message 'Call to undefined function: mysql_connect() ' making me think that mysql is not running at all.



Hope anyone can put me in the right direction

My phpinfo file is
Patrick213.10.104.98/phpinfo.php

Last edited by cuboctahedron; 04-05-2003 at 09:06 AM..
cuboctahedron is offline     Reply With Quote
Old 04-05-2003, 09:50 AM   #2
bentz
Member
 
Registered: Mar 2003
Distribution: Fedora, Mac OSX
Posts: 362
Thanked: 0
How are you connecting to MySQL? Use 'mysql -u root -p' if you've defined a root password for MySQL already, or just plain 'mysql' if you haven't. If MySQL isn't running and you try to connect, you'll get a:
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

I've never seen that error message that you provide in my life.
bentz is offline     Reply With Quote
Old 04-05-2003, 11:32 AM   #3
cuboctahedron
Member
 
Registered: Nov 2002
Posts: 70
Thanked: 0

Original Poster
Hi,

I've created the website on a Windows XP machine using apache2 and php. The connectionstrings I use to connect to the mysql database are e.g.

$hostname = "localhost";
$database = "Systemapp";
$username = "myusername";
$password = "mypassword";
$myconnection = mysql_connect($hostname, $usernamex, $password) or die(mysql_error());

mysql_select_db($database_OfficeBox, $myconnection);
$query = "
SELECT * FROM tbltransgen WHERE idlanguage = ".$_SESSION['sesslanguage']."
";
$transgen = mysql_query($query, $myconnection) or die(mysql_error());
$row_transgen = mysql_fetch_assoc($transgen);
$totalRows_transgen = mysql_num_rows($transgen);

It works fine under Windows, but I want to switch to Linux

How can I check if PHP recognizes mysql; like I said, the mysql service is running
cuboctahedron is offline     Reply With Quote
Old 04-05-2003, 07:23 PM   #4
deckmoney
LQ Newbie
 
Registered: Apr 2003
Distribution: Mandrake 9.1
Posts: 20
Thanked: 0
Talking PHP and mySQL problem

Your problem is most likely that you didn't install the php-mysql-4.3.0-2mdk package, which gives PHP the functions it needs to interact with a mySQL database. I tried to check your phpinfo and your IP address has apparently changed, but I assume this will fix your problem.
deckmoney is offline     Reply With Quote
Old 04-06-2003, 12:39 PM   #5
bentz
Member
 
Registered: Mar 2003
Distribution: Fedora, Mac OSX
Posts: 362
Thanked: 0
That's probably it, deckmoney.

I would also double-check that this user works under the console by using 'mysql -u myusername -p'.
bentz is offline     Reply With Quote
Old 04-13-2003, 04:02 PM   #6
cuboctahedron
Member
 
Registered: Nov 2002
Posts: 70
Thanked: 0

Original Poster
Help,, now I am getting an error ' Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on '127.0.0.1' (111) in /var/www/html/officebox/Connections/myconnections.php on line 12
Can't connect to MySQL server on '127.0.0.1' (111)' .

I am trying to access mysql as username root (both mandrake as mysql)

I installed mysqlcc, a GUI for mysql, but even there I get the same message

Anyone please?
cuboctahedron is offline     Reply With Quote
Old 04-14-2003, 03:34 AM   #7
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu
Posts: 1,042
Thanked: 14
maybe mysql server is running on another host than 127.0.0.1 or is using a different port than 111? are u sure the server is running at all? type
ps -e | grep mysql
to check it
cheers, jens
j-ray is offline     Reply With Quote
Old 04-19-2003, 06:20 PM   #8
cuboctahedron
Member
 
Registered: Nov 2002
Posts: 70
Thanked: 0

Original Poster
Hi ,
(sorry for my late response)
I typed it the command, but mysql is not on the list.

Mysql is installed on 127.0.0.1(locahost)

What must I do to make it appear there on the list.

thanks for assistence

PS the mysql service is running ok

Last edited by cuboctahedron; 04-19-2003 at 06:27 PM..
cuboctahedron is offline     Reply With Quote
Old 04-19-2003, 06:55 PM   #9
Burke
Member
 
Registered: Dec 2002
Location: Virginia, USA
Distribution: Fedora Core 3
Posts: 131
Thanked: 0
That command lists all the current processes.. If mysql is NOT in the list, then it is likely NOT running at the moment. Try typing mysql at the prompt to see if you are taken into the mysql command line client.. If it's not in the list from ps -e, then you should get an error like:
"ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)"

That means that mysql is not running. I've found that occasionally Mandrake refuses to start up mysql properly. So I have added the following commands to /etc/rc.d/rc.local :
sleep 5
/etc/init.d/mysql start

Those commands tell mandrake to wait 5 seconds, then launch mysql. If mysql is already running, no harm done. If it's not, then this starts it. For the moment, try typing "/etc/init.d/mysql start" at the prompt then try your script -- see if it will work now.
Burke is offline     Reply With Quote
Old 04-19-2003, 07:51 PM   #10
cuboctahedron
Member
 
Registered: Nov 2002
Posts: 70
Thanked: 0

Original Poster
Hi,
I typed "/etc/init.d/mysql start" and received a confirmation
Starting Mysql Server [ok] on my screen.

When I type ps-e|grep mysql I see nothing.

What should I do?
cuboctahedron is offline     Reply With Quote
Old 04-19-2003, 08:53 PM   #11
Burke
Member
 
Registered: Dec 2002
Location: Virginia, USA
Distribution: Fedora Core 3
Posts: 131
Thanked: 0
Does your script work right now? And does "mysql" enter you into the command line client?
Burke is offline     Reply With Quote
Old 04-20-2003, 04:26 AM   #12
cuboctahedron
Member
 
Registered: Nov 2002
Posts: 70
Thanked: 0

Original Poster
You mean the Mysql-command line?

I am trying to connect through mysqlcc (a mysql client) , but the errormessages are the same as when I try connecting through php pages.

and keep getting those socket errors, although there is a socket file.
(I've created an empty textfile named mysql.sock).
cuboctahedron is offline     Reply With Quote
Old 04-21-2003, 11:33 AM   #13
cuboctahedron
Member
 
Registered: Nov 2002
Posts: 70
Thanked: 0

Original Poster
Anyone please?.......
I installed mandrake, as a dummy, so I didnt fiddle with any configurations, to say.

What I find strange is, that I can start it (/etc/init.d/mysql start), but that I cannot find a 'mysql' entry when using (ps -e | grep mysql).

Help very appreciated...

cheers
Patrick
cuboctahedron is offline     Reply With Quote
Old 04-21-2003, 12:56 PM   #14
Burke
Member
 
Registered: Dec 2002
Location: Virginia, USA
Distribution: Fedora Core 3
Posts: 131
Thanked: 0
I'm stepping out of this one now.. I'm running Mandrake 9.1 on my machines & have exausted all I can think of on this one.
Burke is offline     Reply With Quote
Old 08-26-2003, 06:20 PM   #15
FlyingSmurf
LQ Newbie
 
Registered: Aug 2003
Distribution: Debian
Posts: 25
Thanked: 0
I had a similar problem, had everything necessary installed from the 9.1 CD's yet php couldn't talk to mysql!!

This is how I fixed it: in /etc/php there's a 34_mysql.ini file that says 'extension = mysql.so'

I replaced mysql.so to the exact location of the file /usr/lib/php/extensions/mysql.so
FlyingSmurf is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. NoviceW Linux - Networking 13 01-19-2009 10:01 AM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. suziecorbett Linux - Software 8 10-09-2008 02:52 AM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock welery Linux - Software 8 07-11-2008 03:06 PM
Problems with MySQL on SuSE: Can't Connect (/var/lib/mysql/mysql.sock) neocookie Linux - Software 8 02-08-2008 12:48 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 09:44 AM


All times are GMT -5. The time now is 02:12 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration