image
image

Go Back   macosx.com > Design, Media, Programming & Scripting > Design & Media

Reply
 
Thread Tools
  #1  
Old March 16th, 2005, 03:53 PM
Registered User
 
Join Date: Mar 2005
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
midazolam is on a distinguished road
Über n00b setting up PHP and MySQL - shell syntax problem?

Hi everyone,

Here's where I'm at so far:

I have d/l and installed the PHP module from Mark Liyanage (http://www.entropy.ch/software/macosx/php/).

I have d/l and installed the MySQL pkg file from MySQL.com (the one for OSX)

I have been following a tutorial on MacWorld's site that I remembered reading a while ago: http://www.macworld.com/2002/11/features/database/

Here's what IS working:

PHP is installed and running - accessing the test.php file I created gives me the page Mark says it will on his site (also in the MacWorld tut).

MySQL is installed and the PrefPane says it is running. (Startup item was also installed)

Here is the problem:

In the Macworld Tutorial (and others I've seen online), you set up your password in the config.inc.php file, which I did. I also set up the $cfg['Servers'][]['auth_type'] = 'config'; line to read "http" between the single quotes. When I try to connect to MySQL through PHP MyAdmin it says the password is incorrect. So back to the MacWrold tut, it says to set your password in MySQL by typing the command:
rehash; mysqladmin -u root password newpassword
where newpassword is the password that you put in the config file. Problem is, this tut was written when the shell was tcsh and not bash. bash doesn't like the rehash command, and hash doesn't work properly with the commands that follow it.

First thing I tried was to try what they suggest in the MacWorld tut to test and see if the MySQL install really _was_ running, and went to Terminal and typed mysql -u root -p. Password _still_ doesn't work.

Suggestions?

Thanks in advance for taking time to read this!

:m
Reply With Quote
  #2  
Old March 16th, 2005, 07:02 PM
michaelsanford's Avatar
Psycholinguist
 
Join Date: Oct 2002
Location: Ottawa/Montréal
Posts: 2,174
Thanks: 0
Thanked 0 Times in 0 Posts
michaelsanford is on a distinguished road
I see from that confic.inc.php linethat you're using phpMyAdmin ? It's usually a good idea to include information like that, because it's in fact (probably) not MySQL that not working properly, but phpMyAdmin.

Did you change your root mysql password when you installed it ? If you used the .pkg installer (which is IMO the way to go on OS X) you won't have. MySQL keeps its passwords in its own database, so it WON'T be the same as your Mac OS X "root" users password.

Try logging in in the Terminal like this
mysql -u root (without the -p)

If that works then you have your problem. Type this then in the terminal (to change your root password, note that the first 'password' there is not your current password but is a command, the second one in quotations marks IS a new password):
mysqladmin -u root password 'mynewpassword'
__________________
michaelsanford.comBlogTwitterTumblrLinkedIn
• iMac Aluminum 24" |
MacOS X 10.5-current | 3.06 GHz Intel Core Duo | 4 GB RAM | 1 TB HDD
• iBook G4 1.42 GHz | MacOS X 10.5-current | 1 GB RAM, 100 GB HDD
• AMD Athlon64 3500+ | Slackware 12 (2.6.21.5-smp) | 2 GB RAM, 2•120 GB RAID 1, 2•500 GB RAID 0
Reply With Quote
  #3  
Old March 16th, 2005, 07:10 PM
Registered User
 
Join Date: Mar 2005
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
midazolam is on a distinguished road
Something's not right...

Hey Michael - thanks for your reply.

I *did* change the password in th config file to what I wanted it to be, but still no dice.

I just tried your suggestion of logging in to MySQL without the password, and I get the following:

-bash: mysql: command not found

I did install MySQL using a .pkg installer and if the PrefPane is any indication, the install DID work. I should also mention that I am running the latest version of OS X (10.3.8) with all of the latest updates.

Thanks for your help so far and hopefully you'll have some insight as to what's happening here.

:m
Reply With Quote
  #4  
Old March 16th, 2005, 07:14 PM
michaelsanford's Avatar
Psycholinguist
 
Join Date: Oct 2002
Location: Ottawa/Montréal
Posts: 2,174
Thanks: 0
Thanked 0 Times in 0 Posts
michaelsanford is on a distinguished road
When you say " I *did* change the password in th config file to what I wanted it to be" you mean in config.inc.php ?
__________________
michaelsanford.comBlogTwitterTumblrLinkedIn
• iMac Aluminum 24" |
MacOS X 10.5-current | 3.06 GHz Intel Core Duo | 4 GB RAM | 1 TB HDD
• iBook G4 1.42 GHz | MacOS X 10.5-current | 1 GB RAM, 100 GB HDD
• AMD Athlon64 3500+ | Slackware 12 (2.6.21.5-smp) | 2 GB RAM, 2•120 GB RAID 1, 2•500 GB RAID 0
Reply With Quote
  #5  
Old March 16th, 2005, 07:15 PM
Registered User
 
Join Date: Mar 2005
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
midazolam is on a distinguished road
Yes, that's correct. I left 'root' but changed the pass to what I wanted it to be...then saved the file.

:m
Reply With Quote
  #6  
Old March 16th, 2005, 07:18 PM
michaelsanford's Avatar
Psycholinguist
 
Join Date: Oct 2002
Location: Ottawa/Montréal
Posts: 2,174
Thanks: 0
Thanked 0 Times in 0 Posts
michaelsanford is on a distinguished road
Ok that's what I'm talking abuot--you're confounding phpMyAdmin, which is a web based INTERFACE for MySQL, and the ACTUAL MySQL SERVER.

In the terminal do this:
ps ax | grep mysqld | grep -v grep

Do you get a line that looks like this
352 ?? S 5:34.55 /usr/local/mysql/bin/mysqld --defaults-extra-file=/usr/local/m....blah blah

Or do you get nothing ?
__________________
michaelsanford.comBlogTwitterTumblrLinkedIn
• iMac Aluminum 24" |
MacOS X 10.5-current | 3.06 GHz Intel Core Duo | 4 GB RAM | 1 TB HDD
• iBook G4 1.42 GHz | MacOS X 10.5-current | 1 GB RAM, 100 GB HDD
• AMD Athlon64 3500+ | Slackware 12 (2.6.21.5-smp) | 2 GB RAM, 2•120 GB RAID 1, 2•500 GB RAID 0
Reply With Quote
  #7  
Old March 16th, 2005, 07:25 PM
Registered User
 
Join Date: Mar 2005
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
midazolam is on a distinguished road
Actually, Terminal flicks for a split second, then I get my default prompt... it doesn't show anything at all...

:m
Reply With Quote
  #8  
Old March 16th, 2005, 07:31 PM
michaelsanford's Avatar
Psycholinguist
 
Join Date: Oct 2002
Location: Ottawa/Montréal
Posts: 2,174
Thanks: 0
Thanked 0 Times in 0 Posts
michaelsanford is on a distinguished road
Ok that means your mysql server isn't actually running. Also I'm concerned about your bash: error because it means that it can't find the mysql client program to communicate with the mysql server.

You ran the mysql.pkg installer and installed the startup item also ?

In the Terminal type
ls /usr/local/mysql you should get output like this:

homestar-runner:/usr/local/mysql root# ls /usr/local/mysql
COPYING bin include scripts tests
EXCEPTIONS-CLIENT configure lib share
INSTALL-BINARY data man sql-bench
README docs mysql-test support-files


If it says instead
ls: /usr/local/mysql: No such file or directory
Then either Mysql got installed in a funny place, or the install didn't work properly.

If the second one is the case, try reinstalling the .pkg.

Just remember, phpMyAdmin is not MySQL itself, it's just an interface. Think of it like the phones in your house. You can pick up any number of different telephones but they all ring the same number, right ? That's like phpMyAdmin. It's just one of the numerous ways you can communicate with MySQL, which would be the phone line in this analogy.

Editing config.inc.php has NO effect on MySQL's passwords.

Incidentally, if you select the http config method you don't need to put in a password because you'll be prompted for one when you hit the page with your web browser.
__________________
michaelsanford.comBlogTwitterTumblrLinkedIn
• iMac Aluminum 24" |
MacOS X 10.5-current | 3.06 GHz Intel Core Duo | 4 GB RAM | 1 TB HDD
• iBook G4 1.42 GHz | MacOS X 10.5-current | 1 GB RAM, 100 GB HDD
• AMD Athlon64 3500+ | Slackware 12 (2.6.21.5-smp) | 2 GB RAM, 2•120 GB RAID 1, 2•500 GB RAID 0
Reply With Quote
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -5. The time now is 01:31 AM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.