LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 04-21-2004, 05:28 PM   #1
gkaffen338
LQ Newbie
 
Registered: Apr 2004
Distribution: mandrake 9.2
Posts: 3

Rep: Reputation: 0
can not connect to sql with php


I have a stock mandrake box with sql and php that was loaded during install of the os.

I have 2 questions,

1. i can get into the db using sqlcc in the gui but i dont know how to get into it in the command line. I read the documentation and its not working. I dont know if im not in the right directory or what.

2. In php when i use the mysql_pconnect or mysql_connect i get

Fatal error: Call to undefined function: mysql_pconnect() in /var/www/html/dbtest.php on line 3


any idea? Im stumped.
 
Old 04-21-2004, 05:46 PM   #2
mandeltuete
Member
 
Registered: Mar 2003
Location: Switzerland
Distribution: Fedora 3
Posts: 75

Rep: Reputation: 15
Create a php file with phpinfo() and look if there's MySQL support built in.

On command line connect to mysql:
# mysql -uroot -p
If it doesn't find mysql, you probably have to use: /usr/local/mysql/bin/mysql or whereever your mysql is installed.
# locate mysql
will tell you that.

HTH
 
Old 04-21-2004, 09:48 PM   #3
gkaffen338
LQ Newbie
 
Registered: Apr 2004
Distribution: mandrake 9.2
Posts: 3

Original Poster
Rep: Reputation: 0
phpinfo

I dont think its set up to do SQL how do i tell php to work with sql? Here is the php info page http://www.grimmtask.com/phpinfo.php what do i look for?
 
Old 04-22-2004, 08:33 AM   #4
wfareed
LQ Newbie
 
Registered: Sep 2003
Location: egypt
Distribution: slackware 12.1 , ubuntu 8.04
Posts: 13

Rep: Reputation: 0
about connecting from the command line , if u have set a password for root , u will use [ mysql -u root -ppassword ] and if not , it is just [bash# mysql ]
and about the call to undefined function , i think u need to install the [php-mysql package] it contains all the mysql related functions that allows php to talk to mysql ....
 
Old 04-22-2004, 09:28 AM   #5
mandeltuete
Member
 
Registered: Mar 2003
Location: Switzerland
Distribution: Fedora 3
Posts: 75

Rep: Reputation: 15
You should definitely use a password for mysql. mysql -uroot -p will also work, but will prompt you for the password.

If you install PHP from tarball, MySQL support is built in by default. Your setup seems to be different. In your phpinfo there's:
"Extensions listed here are (or will be soon) available as external modules. To install one or all of these, use "urpmi" php-EXTENSION_NAME"
Well, try that, as root, you may do:
# urpmi php-mysql

HTH
 
Old 04-22-2004, 11:36 AM   #6
gkaffen338
LQ Newbie
 
Registered: Apr 2004
Distribution: mandrake 9.2
Posts: 3

Original Poster
Rep: Reputation: 0
You guys rock! That worked!

Thanks
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
MY SQL cant connect to sock kizuna Slackware 7 11-12-2005 07:49 AM
TOMCAT connect to MS SQL database shane200_ Suse/Novell 1 06-01-2005 01:41 PM
php trying to connect to local sql, error no such database feetyouwell Programming 11 02-08-2005 12:25 PM
Connect to SQL Server dhome Linux - Software 1 03-08-2004 12:56 PM
Use SSH to connect MS SQL Servers jweag Linux - Networking 2 11-12-2003 09:13 PM


All times are GMT -5. The time now is 05:28 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 Google+: linuxquestions
Open Source Consulting | Domain Registration