LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-20-2008, 11:53 PM   #1
Anauj0101
LQ Newbie
 
Registered: Mar 2002
Posts: 26

Rep: Reputation: 15
Where are the database files for mysql in Centos 5?


Where are the database files for mysql in Centos 5?

This would be mysql ver 5
The problem i am having is that i cant connect to mysql from apache all of my php script works and i can make, use, edit tables from the command line but the connect statement does nothing, not even an error message.
$connection = mysql_connect("localhost","user","password");
if (!$connection) {
echo "COULD NOT CONNECT!!";
}
echo "connect successful";

Last edited by Anauj0101; 02-21-2008 at 12:17 AM.
 
Old 02-21-2008, 03:13 AM   #2
Angel2953
Member
 
Registered: Sep 2005
Location: Poland
Distribution: Debian, Ubuntu
Posts: 38

Rep: Reputation: 16
if you wana find mysql db files then run this:
Code:
# find / -name "*.MYI" -exec ls -al {} \;
this will find any file that has extension MYI (one of mysql table files)

But you might have display_errors set to off in your php.ini then it should be like this:
Code:
<?php
init_set('display_errors', 1 );
error_reporting( E_ALL );

// rest of your script
?>

Last edited by Angel2953; 02-21-2008 at 03:14 AM.
 
Old 02-21-2008, 10:53 AM   #3
Anauj0101
LQ Newbie
 
Registered: Mar 2002
Posts: 26

Original Poster
Rep: Reputation: 15
Well thanks i found the db files, but when i enter the code it does nothing after it, not even a simple echo statement. Im stumped, the php.ini file seems to be set up to work with mysql. It should work right?
 
Old 02-21-2008, 11:11 AM   #4
Angel2953
Member
 
Registered: Sep 2005
Location: Poland
Distribution: Debian, Ubuntu
Posts: 38

Rep: Reputation: 16
just for sure run this:
Code:
$ php --ri mysql
you should get something like this:
Code:
dawid@rei:~$ php --ri mysql

mysql

MySQL Support => enabled
Active Persistent Links => 0
Active Links => 0
Client API version => 5.0.51
MYSQL_MODULE_TYPE => external
MYSQL_SOCKET => /var/run/mysqld/mysqld.sock
MYSQL_INCLUDE => -I/usr/include/mysql
MYSQL_LIBS => -L/usr/lib -lmysqlclient

Directive => Local Value => Master Value
mysql.allow_persistent => On => On
mysql.max_persistent => Unlimited => Unlimited
mysql.max_links => Unlimited => Unlimited
mysql.default_host => no value => no value
mysql.default_user => 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.connect_timeout => 60 => 60
mysql.trace_mode => Off => Off
dawid@rei:~$
Does simple echo statement work or doesn't display anything (sth like: <?php echo "test\n"; ?>) and does
Code:
<?php phpinfo(); ?>
displays anything ? If no then maybe you have some buffering/caching options enabled that prevents displaying results...
 
Old 02-21-2008, 10:36 PM   #5
Anauj0101
LQ Newbie
 
Registered: Mar 2002
Posts: 26

Original Poster
Rep: Reputation: 15
When i type the line, php --ri mysql
I get
Could not open input file: mysql

And yes phpinfo does work
 
Old 02-23-2008, 05:39 PM   #6
Anauj0101
LQ Newbie
 
Registered: Mar 2002
Posts: 26

Original Poster
Rep: Reputation: 15
Thanks for all the help, i fixed it by accident. Apparently i didnt initialize something because a restart fixed it.......I feel somewhat stupid now.
 
  


Reply



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
need to convert text files into mysql database zafar466 Linux - Software 1 08-28-2007 12:53 AM
mysql - can't access mysql database as root yogaboy Linux - Software 5 12-28-2006 06:58 AM
Mysql - Copying database files. jackster Linux - Software 2 02-03-2005 02:03 AM
Writing an app that uses a mysql database without installing mysql server? QtCoder Programming 4 08-09-2004 02:43 PM
MYSQL help - mysql database missing eloviyandhi Linux - Software 1 03-20-2004 09:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration