Results 1 to 10 of 10
Apache is up and running and can parse php files properly.
MySQL is running properly and I can run SQL queries from the CLI but I can't seem to get ...
- 01-20-2006 #1Just Joined!
- Join Date
- Aug 2005
- Location
- Aberdeen, Scotland
- Posts
- 64
MySQL and phpMyAdmin
Apache is up and running and can parse php files properly.
MySQL is running properly and I can run SQL queries from the CLI but I can't seem to get PHP and MySQL to function together.
I've tried connecting to the DB from my own script and it gives the same error as when phpMyAdmin tries to connect...
The login and host details are correct to the best of my knowledge... Any ideas what might be going on?Code:phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in config.inc.php and make sure that they correspond to the information given by the administrator of the MySQL server.
- 01-21-2006 #2Just Joined!
- Join Date
- Jan 2006
- Posts
- 35
can you post your script?
Im gonna give u a basicscript how you can check if your database is accessible.
<?php
$db_host = "localhost";
$db_username = "root";
$db_password = "";
$err= "Fault while connecting!";
$db_connectie = mysql_connect($db_host, $db_username, $db_password) or die($err); // connect to database, if fail -> show error
?>
Try this script and fill in the good values for $db_host $db_username and $db_password. I think if u didn't change anything the standard password for the user "root" is "" (empty).
The useraccounts from mysql have nothing to do with those from anything else.
Try this. If u can login with the username "root" and password "", you can then configure your phpMyAdmin. After that you can access your database and add users. IMPORTANT!!! Be shure to change the password for the root account. And change the settings in the config file of phpMyAdmin.
Further... Dont let your scripts use the root account. Its very unsafe.
I hope this helps.
- 01-23-2006 #3Just Joined!
- Join Date
- Jan 2006
- Posts
- 71
You may have to edit your php.ini file if you didnt compile php with mysql support.
- 01-26-2006 #4Just Joined!
- Join Date
- Aug 2005
- Location
- Aberdeen, Scotland
- Posts
- 64
Hi, and thanks!
Originally Posted by root@localdomain
This script simply returns 'Fault while connecting!'. Any more ideas?
- 01-27-2006 #5
Create a new file called test.php, and insert this code:
Then place the file in your document root and open it. Then can you post a link or a copy & paste of the info here?Code:<? phpinfo(); ?>
Registered Linux user #389109
My Semi-Linux Blog
- 01-31-2006 #6Just Joined!
- Join Date
- Aug 2005
- Location
- Aberdeen, Scotland
- Posts
- 64
It was too long but I think the bit's you are looking for are...
Code:PHP Version 5.1.1 Configure Command './configure' '--prefix=/usr' '--with-apxs2=/usr/sbin/apxs' '--enable-force-cgi-redirect' '--enable-discard-path' '--enable-fastcgi' '--with-config-file-path=/etc/apache' '--enable-safe-mode' '--with-openssl=/usr' '--with-zlib=/usr' '--with-zlib-dir=/usr' '--enable-bcmath' '--with-bz2=/usr' '--enable-calendar' '--with-curl=/usr' '--with-curlwrappers' '--enable-dba' '--with-gdbm=/usr' '--with-db4=/usr' '--with-inifile' '--with-flatfile' '--enable-dbase' '--with-libxml-dir=/usr' '--enable-exif' '--enable-filepro' '--enable-ftp' '--with-openssl-dir=/usr' '--with-gd' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-zlib-dir=/usr' '--with-t1lib=/usr' '--enable-gd-native-ttf' '--enable-gd-jis-conv' '--with-gettext=shared,/usr' '--with-gmp=/usr' '--enable-mbstring' '--with-libmbfl' '--with-mhash=/usr' '--with-mysql=shared,/usr' '--with-mysql-sock=/var/run/mysql' '--with-zlib-dir=/usr' '--enable-embedded-mysqli' '--with-ncurses=/usr' '--enable-shmop' '--with-libxml-dir=/usr' '--enable-soap' '--with-libxml-dir=/usr' '--enable-sockets' '--enable-sqlite-utf8' '--with-regex=php' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-wddx' '--with-libxml-dir=/usr' '--with-xmlreader' '--with-libxml-dir=/usr' '--with-pear' '--with-zend-vm=CALL' '--with-tsrm-pthreads' '--enable-shared' '--enable-static' '--program-prefix=' '--program-suffix=' mysql MySQL Support enabled Active Persistent Links 0 Active Links 0 Client API version 5.0.18 MYSQL_MODULE_TYPE external MYSQL_SOCKET /var/run/mysql/mysql.sock MYSQL_INCLUDE -I/usr/include/mysql MYSQL_LIBS -L/usr/lib -lmysqlclient Directive Local Value Master Value mysql.allow_persistent On On mysql.connect_timeout 60 60 mysql.default_host no value no value mysql.default_password no value no value mysql.default_port no value no value mysql.default_socket no value no value mysql.default_user no value no value mysql.max_links Unlimited Unlimited mysql.max_persistent Unlimited Unlimited mysql.trace_mode Off Off
- 02-01-2006 #7Just Joined!
- Join Date
- Jan 2006
- Posts
- 4
Could this be a firewall issue? Maybe you might need to open a few ports. I've experienced this but I can't remember if it gave me the same message.
- 02-01-2006 #8Just Joined!
- Join Date
- Aug 2005
- Location
- Aberdeen, Scotland
- Posts
- 64
I thought this but I have tried this solution and it didn't help. I opened port 3308 on my router (Virtual Servers) and it didn't help at all. I'm not running the Linux Firewall because I have a hardware firewall. I'm not too sure if the computer even has to put a request outside of my network.
Originally Posted by Lucidity
- 02-01-2006 #9Just Joined!
- Join Date
- Jan 2006
- Posts
- 35
lol
sorry but I think you are searching to far.
First try the script I gave you.
or use this, its a bit modified, it now shows the error php gives when it tries to connect to the mysql database.
<?php
$db_host = "localhost";
$db_username = "root";
$db_password = "";
$db_connectie = mysql_connect($db_host, $db_username, $db_password) or die(mysql_error()); // connect to database, if fail -> show error
?>
If this gives an error, you know it cant connect to the mysql database.
Be shure to check that there is an mysql account for the user and password and host you provided with $db_host $db_username $db_password.
If you want help with this ask me.
Be shure you started the mysql server.
Then try what Bailz said.
Also, maybe it is good to try "iptables -F".It will flush your firewall rules.
Then try agian. I searched 5hours to solve a problem because of I thought the firewall was shutted down.
If you want more help, also ask me.
- 02-01-2006 #10Just Joined!
- Join Date
- Aug 2005
- Location
- Aberdeen, Scotland
- Posts
- 64
It's Bailz that is having the trouble!
Originally Posted by root@localdomain 
I ran this code:
It says the the connection to the server was lost during the query and the ping function says that the server is not there.Code:$connect = mysql_connect('127.0.0.1','root',''); echo "<b>Connect Result: </b>"; if($connect){ echo "I've connected..."; } else { echo "Could not connect: " . mysql_error(); $ping = mysql_ping('127.0.0.1'); echo "<br /><b>Ping Results: </b>"; if($ping){ echo "Database is there..."; } else { echo "Database is <b>not</b> there..."; } }


Reply With Quote