The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   UNIX - General (http://hintsforums.macworld.com/forumdisplay.php?f=16)
-   -   problem with MySQL (http://hintsforums.macworld.com/showthread.php?t=8293)

vincentm 01-06-2003 11:52 PM

problem with MySQL
 
Hi,
I have recently installed mysql and php and I installed everything as written on the website of Marc L. www.entropy.ch. I want to connect from a terminal window to the MySQL server with the command "sudo mysql". It worked only once but now I have the following error. "sudo:mysql: command not found" I'm ask to enter a password because I changed the root password. What's the problem?

I know that mysqld is running because I have it in the ps list. I have written a php page with an access to mysql and it is working. With that script a create a database, a table, a row and finally select it. Everything works except this command! I don't understand and try everything I can think of! It's maybe very stupid but don't see it.

ericw13 01-07-2003 07:31 AM

Sounds like the mysql client executable is not in your path. Did you move the program mysql? Did you take something out of your path?

Try 'which mysql' to see if mysql is indeed in your path. If not, try

find /sw -name mysql

if you installed mysql via fink (and fink is set up to put programs in the /sw hierarchy); or

find /usr -name mysql

if you manually installed it. Once you find the mysql program, see if its directory is in your path (which you can check with 'echo $PATH'). If it isn't, you can add it to your path in .profile, .tcshrc, or another of the standard startup scripts run when you start a terminal session.

Everything you have said indicates the problem is that the shell doesn't know what you mean when you say 'mysql', meaning there is no program of that name in your path.

On another note, is there a reason you want to run an interactive client session as root? Why not just mysql, or, to use mysql as another user,

mysql -u <username>

HTH
Eric

ktaur 01-13-2003 05:39 AM

I'm very much a newbie, but I had a problem with this, and here's how I solved it:

Open a new Terminal window and type:
su root

...then enter the root password

then, type:

/usr/local/bin/mysql

You'll be welcomed to MySQL Monitor.

Hope this helps. You might also try installing the script from entropy.ch that starts MySQL at system startup.

vincentm 01-13-2003 12:22 PM

Actually, the problem was the path as suggest by ericw13. The problem I had at that point was that I knew what was wrong but didn't knew how to solve it.

So,I searched over the web and found the following:

To add a path to the environment, you need to put in a .login file in your user account a simple line. That is if you want to add the path every time you log-in because you can type manually the command below in your terminal and it will work.

"setenv PATH /usr/local/mysql/bin/:$PATH" (without quotes)

open a terminal window
type sudo pico .login
enter your password
enter the line "setenv PATH ...."
Ctrl-X, y and that's it!

Enjoy!

ericw13 01-13-2003 12:25 PM

Sorry... didn't know it would be that hard to track down this information. If only you'd confirmed the problem, someone might have posted the details :)

Anyway, glad it's all working for you now!

Eric

vincentm 01-13-2003 12:46 PM

It's not your fault....eric! And it was interesting to search for that information that way I will always remember it ....;-) I'm new to mac os x....I always worked with mac but...it was easier than that and I'm so amaze with all the stuff we can do now that I want to try everything. I'm actually learning a lot of thing for my job on linux and I'm very proud to say that I can do the same with my mac!

Have a nice day!

Vincent

td6 01-14-2003 08:44 PM

MySQL
 
Vincentm

What version of OSX are you running and have you updated to MySQL 4.0.9 yet?

I'd like to add MySQL and PHP to my mac as well...

thanks...

ktaur 01-14-2003 08:55 PM

I'm running MySQL 3.23.53 on an Apache webserver running under Mac OS 10.2.3.

I would suggest getting it from Entropy.ch (Mark Liyanage), as it's pretty easy to set up. Except for the problem I'm having right now, it's all running very nicely.

NOTE: 4.0.9 is very new, and I wouldn't recommend running that from the getgo. Start with the pretty stable 3.23.53, then update later after more bugs are fixed...

vincentm 01-14-2003 08:56 PM

I'm running mac os 10.1.5 and 10.2.3

I know that you can install mySQL and PHP on both of course and mostly with the same command. Personnally, I did it with OS X 10.1.5 and with the version 3.23.53 of MySQL and PHP 4.2.2

I suggest you to visit http://www.entropy.ch/software/macosx/
On the site, you will find all the instruction for OS X 10.2 AND 10.1.x

Enjoy

vincentm 01-14-2003 08:59 PM

ktau is right you should start with a stable version first...

td6 01-15-2003 08:47 AM

... thanks for the info!

Being a newbie with MySQL, how will we know when 4.0.?? will be stable??--(just like any other software, keep an eye on it?)

vincentm 01-15-2003 08:59 AM

if you go in the download section of the mysql website you will see to version available. One is stable and the other is "gamma release" (unstable)....when the 4.0 version will be stable the gamma release will be change for stable and the older version will be remove from the page.

That's the easiest way to know when the 4.0 version will be stable.

But, I suggest you to stay tuned on the website of Marc L. (www.entropy.ch) and he will release a new OS X version when it will be available.

You can also subscribe to the mysql newsletter! That's another good way to know it. (www.mysql.com)

Hope this help... ;-)

td6 01-15-2003 09:08 AM

dig it! I'll check everything out...


thanks...

td6 01-17-2003 09:30 AM

MySQL
 
After installing MySQL, I'm not sure its running, or if I actually installed it... After installing the mysql-startupitem script, and going into the terminal (after a restart) and running the command "top" I don't see mysql. How do I know I installed it correctly?

vincentm 01-17-2003 10:24 AM

Ok, there is many way to know that....

Option 1 is the easiest and option 2 is harder...option 3 a little more complicated and option 4 a little more than 3. ;-) I know that there are more option that you could do...but does are the one that I use.

Option 1 : - Open the application Process Viewer. You can find it in /Application/Utilities
- Inside the input box on top of the window type "mysqld" (without quotes)
If you see a process, you're installation of MySQL is OK.

Option 2 : Open a terminal window and type "ps -aux" and check in all the list if there is a "mysqld" process. This option is easier than the option 3 but you will have to check in a bigger list and could be long.

Option 3 : Open a terminal window
and type su mysql
(I supposed you have created a mysql user as suggest by the website of Marc L. www.entropy.ch)
Finally, type ps -u...check if there is a mysqld process.

Option 4 : - Open a Terminal window
login as root with the command su root
Enter password
(I supposed here that the user root exist)
If not, go there if you want to create it or go to option 3 :
http://www.macosxhints.com/article.p...10324095804436
OR
http://www.osxfaq.com/Tutorials/Root...ation/index.ws
Finally type : "ps -u" and check if there is a process name "mysqld"

ericw13 01-17-2003 10:41 AM

For a CLI junkie like myself, the following is both the easiest and quickest:
Code:

ps -auxww | grep mysqld
The ww flag may not be needed in this case, but it's a good habit to get into. ps typically truncates output at 80 characters. The w flag appears to give you an extra 40 characters. The ww flag forces no truncation... ps outputs the entire path to the executable as well as all command line flags/options/inputs.

Of course, you could just watch the Starting Services screen during boot up. I usually notice the mysqld item flash by!

Eric

td6 01-17-2003 10:51 AM

option 1 worked... thanks! and its running...

Basically, I'll I'm trying to do is set-up my mac so I can build MySQL/PHP sites in dreamweaver, and test them locally before uploading to the server.

The one thing i didn't do is make a MySQL user. I'll have to figure that one out...

td6

vincentm 01-17-2003 11:30 AM

Thank you for the hint eric...I take note of that...Especially the w flag but I think that in most case when you install a new piece of software like MySQL...the problem of truncated path is not applicable because I and many people didn't put things so far because its too long to type all the path when you are in terminal mode. For that reason when you want to check process the w flag is useless but if you want to check the process of GUI apps and others, sure it helps!

td6 04-30-2003 01:44 PM

ERROR 2002:
 
OK---now my MySQL is not running. when I try to connect, I get this error "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)" . I'm running the latest completeMySQL 4.0.12.

--don't know what happened... It was working fine...

td6

vincentm 04-30-2003 02:15 PM

Error log
 
Did you check your MySQL error log? What's in the log?
Is your MySQLd always running?
Did you change the user database in MySQL?
Do you have a program to check your database, like PHPMyAdmin?

Answers would be appreciate for further help...;-)

td6 04-30-2003 02:48 PM

1) how can I check the log if MySQL isn't running?

2) I checked in Process viewer, and the mysqld is not located/running. I know it should be...

3) I don't think i changed the database

4) no, i don't have PHPMyAdmin

vincentm 04-30-2003 03:34 PM

Help after answer..
 
hi,

you don't need mysql running to check the log...I'm not talking about the query log, I'm talking about the ERROR log...and this file can be everywhere depending of your installation and/or/configuration.

This is from the mysql website:
Quote:

Beginning with MySQL 4.0.10 you can specify where mysqld stores the error log file with the option --log-error[=filename]. If no file name is given mysqld will use mysql-data-dir/'hostname'.err on Unix
Hope that help for the first question...
When you have the error log file...check the file with the following command:
tail file.err
and post the results in this thread...

Secondo,

Have you installed the StartupScript package from the Mark L. website? If yes, well, your mysql installation doesn't start for some reason! Did you upgrade your system lately? If yes, re-install the startupscript.

If you didn't install the StartupScript, try to start the mysqld from a terminal window with a command like this one :
"sudo /usr/local/mysql/bin/mysqld_safe &"
check the processviewer after that...
if mysqld is not running...you have a problem with your mysql config.

Finally, an utility like PHPMyAdmin can be useful to track problems and manage your database...but it is not usefull in your case right now...because mysqld is not even running so PHPMyAdmin is not going to work anyway...

Hope that help...i'm not so far if you need more help...

td6 04-30-2003 04:01 PM

GOT IT
 
i installed another startup script package. that took care of the problem!
thanks!

ok, I downloaded PHPMyAdmin... I'll load it and check it out... but whats the difference between using:

SQL Boss
FileMakerPro 6
CocoaMySQL
YourSQL
PHPMyAdmin

???
thanks
td6

td6 04-30-2003 04:20 PM

<<laughing>> ready to shake your head?? in the terminal its says "Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 3.23.53-entropy.ch"

and in the pref pane, it says version 4.0.12 running...

I trust the terminal... i guess i'll update to completeMySQL version 4.

T

vincentm 04-30-2003 04:42 PM

Differences
 
hi,

Mmmm....well...I can tell you what are the big lines for each of them, but I never used them all. So, I'll try to do my best!

All these softwares are use for the same thing...manage database.

YourSQL is a GUI (Graphical user interface) app made for mac os x only...the author suggest CocoaMySQL for advanced features....;-) Only usefull with MySQL database type


CocoaMySQL is a GUI app for mac os x only but the program is written in Cocoa. Much faster on mac os x since it use the power of Quartz and etc... but is about the same as YourSQL.

SQLBoss is a commercial tool...$$$$...but it is also a GUI app and can be use on many OS like windows and mac. Can manage MySQL, ODBC, postgreSQL and a few more database type.

FileMaker Pro is a commercial tool...$299.... It is not the same as MySQL...Filemaker is using its own type of database. You can import/export to/from SQL and ODBC database.

PHPMyAdmin is only usefull with MySQL database. The biggest advantage of this utility is that you don't need a particular piece of software or client since this utility is running on the remote host. So, you can manage your database from everywhere and on every OS. You just need a browser with the Internet enabled! It's also free!

They all do approximately the same task..choose the one you prefer or/and meet your needs. YourSQL and CocoaMySQL are maybe the most appropriate for you. It depend...


Good luck!
Vincent

vincentm 04-30-2003 04:50 PM

Hmmm... i don't understand...you log in the mysql server with your terminal and you saw 'version 3-23.53'...

you go in the pref panel and you saw version 4.0......fff!

OK....!

Well....I don't have mysql running on mac os x 10.2.5 and it must sound stupid but which pref panel are you? Are you talking about a software that we mention earlier? Because I don't use them...except PHPMyAdmin. I'm a freaky command line geek about *nix software...

So, more info would be very appreciate!

Bye

td6 05-01-2003 08:42 AM

"your MySQL connection id is 2 to server version: 3.23.53-entropy.ch"--that's what it says in the terminal... and in the MySQL pref pane, it says version 4.0.12: status: running... ????

i have it running ok on a g3 (10.2.5) where it says it's running 4.0.12 (both locations). I reinstalled the completeMySQL 4.0.12, and i get the same result...(on the g4)

T

vincentm 05-01-2003 09:50 AM

upgrade??
 
Hi,

Did you upgrade your mysql version from 3.23-53 to 4.0.x before you had your problem?

Because it is very strange...could be interesting to know what went wrong in this case....

Have a nice day
Vincent

td6 05-01-2003 10:00 AM

I had upgraded to 4 prior to these problems... I have an idea... I'll check it out and let you know...

later
T

td6 05-01-2003 01:58 PM

nevermind...I downloaded the standard 4 version and got it to update. I've been trying to use completeMySQL and that wasn't updating...

thanks for the info!
T

td6 05-02-2003 09:21 AM

miller time
 
ok... i tried this...

mysql -u root -p test

and i get this...

ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)


so, i tried this...

root# safe_mysqld &

and i get this...

root# The file /usr/local/mysql/libexec/mysqld doesn't exist or is not executable
Please do a cd to the mysql installation directory and restart
this script from there as follows:
./bin/mysqld_safe.


when i type groups
i get: staff mysql admin

so i can't figure out why MySQL won't let me in?

I know the mysqld is running, because I checked it in process viewer...

vincentm 05-02-2003 09:32 AM

Upgrade
 
OK....well did you do a command like this one when you re-installed mysql

Code:

mysqladmin -u root password new_password_here
If no, this could be the problem...

And the safe_mysqld isn't working because it is not in your path...
you have to type the full path to the script. Like this :

Code:

sudo ./usr/local/mysql/bin/mysqld_safe &
Apparently you are making some basic mistake due to your upgrade process...
I highly suggest that you read the Marc Liyanage website

Always there if you need....
--
Vincent


All times are GMT -5. The time now is 05:36 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.