LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux 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
 
LinkBack Search this Thread
Old 04-05-2003, 08:05 AM   #1
cuboctahedron
Member
 
Registered: Nov 2002
Posts: 70

Rep: Reputation: 15
mysql and mandrake 9.1


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 08:06 AM.
 
Old 04-05-2003, 08:50 AM   #2
bentz
Member
 
Registered: Mar 2003
Distribution: Fedora, Mac OSX
Posts: 362

Rep: Reputation: 30
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.
 
Old 04-05-2003, 10:32 AM   #3
cuboctahedron
Member
 
Registered: Nov 2002
Posts: 70

Original Poster
Rep: Reputation: 15
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
 
Old 04-05-2003, 06:23 PM   #4
deckmoney
LQ Newbie
 
Registered: Apr 2003
Distribution: Mandrake 9.1
Posts: 20

Rep: Reputation: 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.
 
Old 04-06-2003, 11:39 AM   #5
bentz
Member
 
Registered: Mar 2003
Distribution: Fedora, Mac OSX
Posts: 362

Rep: Reputation: 30
That's probably it, deckmoney.

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

Original Poster
Rep: Reputation: 15
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?
 
Old 04-14-2003, 02:34 AM   #7
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu
Posts: 1,198

Rep: Reputation: 76
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
 
Old 04-19-2003, 05:20 PM   #8
cuboctahedron
Member
 
Registered: Nov 2002
Posts: 70

Original Poster
Rep: Reputation: 15
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 05:27 PM.
 
Old 04-19-2003, 05:55 PM   #9
Burke
Member
 
Registered: Dec 2002
Location: Virginia, USA
Distribution: Fedora Core 3
Posts: 131

Rep: Reputation: 15
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.
 
Old 04-19-2003, 06:51 PM   #10
cuboctahedron
Member
 
Registered: Nov 2002
Posts: 70

Original Poster
Rep: Reputation: 15
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?
 
Old 04-19-2003, 07:53 PM   #11
Burke
Member
 
Registered: Dec 2002
Location: Virginia, USA
Distribution: Fedora Core 3
Posts: 131

Rep: Reputation: 15
Does your script work right now? And does "mysql" enter you into the command line client?
 
Old 04-20-2003, 03:26 AM   #12
cuboctahedron
Member
 
Registered: Nov 2002
Posts: 70

Original Poster
Rep: Reputation: 15
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).
 
Old 04-21-2003, 10:33 AM   #13
cuboctahedron
Member
 
Registered: Nov 2002
Posts: 70

Original Poster
Rep: Reputation: 15
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
 
Old 04-21-2003, 11:56 AM   #14
Burke
Member
 
Registered: Dec 2002
Location: Virginia, USA
Distribution: Fedora Core 3
Posts: 131

Rep: Reputation: 15
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.
 
Old 08-26-2003, 05:20 PM   #15
FlyingSmurf
LQ Newbie
 
Registered: Aug 2003
Distribution: Debian
Posts: 25

Rep: Reputation: 15
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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


All times are GMT -5. The time now is 08:51 PM.

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
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration