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 |
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. |
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 |
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.
|
That's probably it, deckmoney.
I would also double-check that this user works under the console by using 'mysql -u myusername -p'. |
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? |
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 |
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 |
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. |
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? |
Does your script work right now? And does "mysql" enter you into the command line client?
|
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). |
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 |
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.
|
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 |
All times are GMT -5. The time now is 07:05 PM. |