# MySQL hell please help!!!



## stefan24 (Apr 20, 2004)

Hello all,

I am really in need of some help with setting up mysql on my panther box,
I have used the marc Liyanage site and a few others but I can't make head nor tail of it 

I think with all the stuff I have done to mysql I think it needs resetting and total re-installing back to a clean version.

I know its a bit much asking for but I really do need a bit of help I can pay in virtual beer 

stef


----------



## mdnky (Apr 21, 2004)

http://www.serverlogistics.com/software.php

Download the app (installer package), double click, follow directions on screen.


----------



## stefan24 (Apr 21, 2004)

thanks for the reply mdnky !!!

I have followed everything with the install and configure of the mysql installer and pdf including setting up of the passwords etc.

I have just opened my terminal window to login to mysql to create a new database and I am still getting the error message...

ERROR 1044: Access denied for user: '@localhost' to database 'sandwiches'

what do I need to do to get around this little problem I feel I we are getting closier to solving this.

thanks again for the help

stefan


----------



## pds (Apr 21, 2004)

try cocoamysql cocoamysql.sourceforge.net/.


----------



## stefan24 (Apr 21, 2004)

I really apperiate all the suggestions for GUI versions of mysql but what I really am looking to do is learn how to build mysql tables etc from the command line.

The reason I am doing this is if I get a job that needs mysql I can't count on the fact that its going to be using mysql GUI's or OS X as it could be Free-BSD, windows, or one the nix's. 

I don't want to sound rude for the help I am getting I truely am thankful but I'm looking to solve the current problems I am experiencing with the command line version of mysql.



stefan


----------



## btoth (Apr 21, 2004)

Are you logging in with a proper user name?  ./mysql -u root -p databasename ?

Then it should ask for a password.  If you still get that error, then there is no user account that allows access from 'localhost' - your computer.  Look up on the mysql site how to add a user @ localhost or % - which means from any domain.

If you still need help I might be able to look up what I did.  It's been a while.

* edit *

Also, if you can create separate users that only have permissions for specific database.  root usually has access to all.  creating tables and databases themselves is very easy, but user management is tricky because of the way the users are stored in the mysql database.

This book: http://www.amazon.com/exec/obidos/t...f=sr_1_1/104-7390841-4603927?v=glance&s=books is actually has good coverage of the basic of administration and use of mySQL... and it's got the mySQL logo on it.


----------



## stefan24 (Apr 21, 2004)

btoth said:
			
		

> Are you logging in with a proper user name?  ./mysql -u root -p databasename ?
> 
> Then it should ask for a password.  If you still get that error, then there is no user account that allows access from 'localhost' - your computer.  Look up on the mysql site how to add a user @ localhost or % - which means from any domain.
> 
> ...




Hooray getting warmer!!!!!

You are correct in assuming I haven't been logging into mysql as a user I had no knowledge of this before well until you wrote it  thanks for the link for the book!! 

I take it covers things for mac os x, is so I am going to get a copy ASAP??? 

I am searching the web for info at the moment on how to set a localhost, looking at the mysql help pages aren't the best.

Is it being really checky if you could help me set up a localhost??
I think I have set one up with the serverlogistic installer program that mdnky told me about.

I do agree creating the table and databases themselves is quite easy task but I think I massively under estimated how hard it was going to be establish the framework to begin with. 

I am very grateful for the help as I think it would be next to near impossible to get this working under my own steam.

thanks again

stefan


----------



## stefan24 (Apr 21, 2004)

After a bit of searching on the web and going through amazon I found the link to Que publishing that book looks like it needs adding to my shelf 

I already have a copy of the sams PHP and MySQL web development but doesn't cover anything on OSX thank you for the book suggestion that rocks 

stefan


----------



## pds (Apr 22, 2004)

Sounds like you are well on your way...

The mySQL documentation has a tutorial of sorts in it too that covers all the basic (and advanced) features. It was where I turned to get the thing running. One thing to be aware of is that the beast works the same on all different platforms. It's a good thing to control it at the terminal level, and to be able to run the sql commands within the program, because you can use them in your programming. But you should know that the gui interfaces will also control it across platform, they are very standard. 

I also am not trying to be rude or to derail your purpose to get down to the brass tacks. You want to be able to do it at the source, but that means you want to know how it works. After you have it installed, it works the same on all platforms. Phpmyadmin is also platform independent and very simple to install.


----------



## stefan24 (Apr 22, 2004)

pds said:
			
		

> Sounds like you are well on your way...
> 
> The mySQL documentation has a tutorial of sorts in it too that covers all the basic (and advanced) features. It was where I turned to get the thing running. One thing to be aware of is that the beast works the same on all different platforms. It's a good thing to control it at the terminal level, and to be able to run the sql commands within the program, because you can use them in your programming. But you should know that the gui interfaces will also control it across platform, they are very standard.



Getting there 

The users of this board have been very helpful and I am very thankful MySQL has been something I completely could get to work and I am nearly there, I now know what questions to ask to get it working before I couldn't!! 

Just to clarify one of your points the MySQL documentation you are referring to is it just the normal one that comes with the install or is the same as this...
http://dev.mysql.com/doc/mysql/en/Mac_OS_X_installation.html
If not could you point me in the right direction?

Now I only need to figure out the following......

1.   set the localhost + password via the terminal
2.   set the permissions to (ubber user) 
3.   figure out how to login in as (ubber user)

Oh sorry about my tone before about the GUI's that was the talk of a stressed human, I know that everyone here is just trying to help people out its no sweat and in the wider view its good to know what is out there to get the job done 

thanks again guys & gals

stefan


----------



## pds (Apr 22, 2004)

No problem about tone, I try to keep my hide thick! 

The link you have is for the install, but note that it is 2.2.3. It is part of a very large document that takes you all the way through the use of the program (8 or 10 chapters as I recall). You can d/l it on that same page- in the left hand column at the bottom - as a chapter per page or as one whole document. It will show you how to set up tables, insert and manipulate data and and and.

hah! ::ha::

Twenty two chapters, seven appendices and two indices


----------



## btoth (Apr 22, 2004)

That book I linked to does cover some basic install steps for OS X, however, like was mentioned above, the mySQL client program (the command line client) is the same no matter what system you're using it on.  So once you're passed the actuall install of the program, the setup and use is pretty much the same.  That MySQL Tutorial book covers a lot of the fundamentals of mySQL and relational database concepts.  It would've made a good book for my intro DB course at college.  I got it for $10.00 on sale which made it even better. 

Now, I don't know what steps you took after running the installer package, and I don't really want to go through it myself at the moment, but I got some info from that book I linked to (I also have the PHP & mySQL, but that's really more of a PHP book).  I'm taking most of this straight from the book, so hopefully it's right!

Assuming that your mySQL is actually running, by default there should be no root password set at all (unless you tried setting one yourself):

./mysql -u root 

That should get you in.  According to the book, if you get an ERROR 2003: Can't connect... blah blah blah, that means it's not running.  Once you're in, you should be able to do:

set password for root@localhost=password('your password');

Hit return.  Then logout (\q) and log back in using:

./mysql -u root -p

And it should ask for your password.

The basics for creating an account (once you can login as root) is:

grant create, delete, execute, insert, (...etc) on *.* to username identified by 'password';

There's also a program called mysqladmin that does some administration stuff, you might try looking at that too.  If you still get that locahost error, maybe try downloading the OS X package from mysql.com rather than those other packages.


----------



## stefan24 (Apr 22, 2004)

btoth said:
			
		

> Assuming that your mySQL is actually running, by default there should be no root password set at all (unless you tried setting one yourself):
> 
> ./mysql -u root



Hello again after a bit of rest and sleep I am back again 

I have typed ./mysql -u root but that doesn't seem to do anything but cause a syntax error which reads 

-bash: ./mysql: No such file or directory

I have been using the MySQL management software recomended by mdnky earlier in the thread, and I have set a password to "login" for setting up purposes will this have any bearing on the command used above?

The login panel says that MySQL is running and the root password has been set how can I login to the account from the command line?

I think I will get the book next week when I get some more cash as I feel kind of bad relying on others genrously to help me out!!

stefan


----------



## dlloyd (Apr 22, 2004)

I quickly scanned this thread, please excuse me if I missed anything, or anything I say has already been mentioned .

I don't know if you resolved the "ERROR 1044: Access denied for user: '@localhost' to database 'sandwiches'" error, but basically it means that you are not using a valid login/password. In your case, you didn't specify either, so that's why you're getting the error.

I recommend using phpMyAdmin for setting up MySQL users (www.phpmyadmin.com), because it makes everything much simpler.
Next; 'localhost' is just how any 'server' (in this case the MySQL server) refers to itself. You can set the server to respond to other addresses as well via something such as phpMyAdmin, but 'localhost' is just one automatically set up.
On the Mac version of MySQL, there is usually also a server called '[insert computer name here].local'. My computer is called 'apollo', so my address is 'apollo.local'. This is *an* address that other computers (in this case, I believe only other computers on your local network, because of the '.local') can use to access the MySQL server.
To recap: if you are going to be accessing the MySQL server from the same computer it's set up on, then you can just use 'localhost', otherwise you need to use some other address.
Now, the catch with this is that each different 'server address' requires that you set up separate usernames. For example, if I set up 'dlloyd@localhost', then I can use this username only if I am connecting to the server address 'localhost'. If I try to use it with 'apollo.local', the MySQL server won't recognize it.

Your current problem is that the shell doesn't know what to do when you type 'mysql'. The following is a copy from Mark Liyanage's website (http://www.entropy.ch/software/macosx/mysql/)



> If you do not want to have to type /usr/local/mysql/bin in front of every single mysql-related command, then you have to add the /usr/local/mysql/bin directory to your PATH environment variable in your shell's login script.
> 
> For the tcsh shell, which was the default up to Mac OS X 10.2 , you can do this by running this command once:
> echo 'setenv PATH /usr/local/mysql/bin:$PATH' >> ~/.tcshrc
> ...



After you do this, you should just be able to type the MySQL commands ('mysql', 'mysqladmin' etc.) without anything else before them and they will work properly. Note that you MUST close and reopen the terminal window before this takes effect. If you are not sure which shell you're using, it should say in the titlebar ('Terminal - [shell type] - [some other info]').

Hope this helps!


----------



## mdnky (Apr 22, 2004)

stefan24,

There's a few things you have to do like setup the root pwd, as other have mentioned.  There should be an install guide included with the package which shows every step to get it up and running, with screenshots.  It should probably be included with the compressed file you downloaded.

http://www.serverlogistics.com/mysql.php


----------



## dlloyd (Apr 23, 2004)

When I tried to set up the root password from the commandline, I always got errors. I used phpMyAdmin (yeah, I know I sound like I work for them, I really don't! ), and it worked fine.


----------



## btoth (Apr 23, 2004)

stefan24 said:
			
		

> Hello again after a bit of rest and sleep I am back again
> 
> I have typed ./mysql -u root but that doesn't seem to do anything but cause a syntax error which reads
> 
> -bash: ./mysql: No such file or directory



You may not need the ./, I use it when I'm in the mySQL folder to run the client because mysql is not added to the path.  Make sure your in the same folder as the mysql command line client.


----------



## stefan24 (Apr 26, 2004)

Sorry for not replying earlier ended up going away for the weekend.
But I would like to thanks everyone how helped me out with this problem.

This site has some excellent people on it...

thanks again

stefan


----------

