Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Just a note to mention a mishap I had with MySQL I had on a running server. It left me stunned and bruised.
First of all, I'm not a big MySQL user. I can do the very basic things. That's all. So, one day, I'm on my gentoo server as root because I'm creating up a database for a certain user. I use the command-line "mysql", and do the operation as mysqlroot user. That's something I've done several times.
This time however, I decide to test it from the command-line. SO I issue
Code:
mysql -u <notrootuser> -p
and duly type in the password, but the password of the database I just created. Note however that I have not specified the database, which was clumsy, I admit.
Now with the "mysql>" prompt, "show databases;" gives me only the databases that that user can see. Then I leave.
Ok, but do you know what actually happened? That command I issued effectively changed the password to the user's _other_ databases as well! So the websites, which those databases fed, led to access errors and failure.
I still can't believe it. Now this may all due to some .mysqlrc config file in the the background (which I don't know about) that allows changing of passwords that easily, but somehow, a command like that, it doesn't seem conventional that it should change passwords, without looking for verification.
Any how, I just wanted to to get that off my chest. Another thing that I notice "mysql" has is a very trendy "man" page. It actually has the options listed out as a table very carefully. There's an artist at work there at MySQL for sure.
I can start to feel that it will only be myself on this thread.
Anyhow, I have started to do a bit of reading, and that command I issued is probably not the change of password command at all.
I burrow my way into the section of their ref book:
MySQL 5.1 Reference Manual :: 5 MySQL Server Administration :: 5.4 The MySQL Access Privilege System
And half way down it says
"A password applies globally to an account. You cannot associate a password with a specific object such as a database, table, or routine."
Nicely hidden away, that one.
So, my thinking has been always wrong on mysql. You don't set up a database for a particular user at all. You set up a database and separately you organise access to it.
This means that if you set up an additional database for a user, you need to know that user's mysql account password beforehand. Is that the way it is? That's a pain.
Thanks for your reply ... yes, I'm aware (especially now) of these things.
I've had to explain this error of mine to a number of people, and here is an extract of my email to them.
Quote:
The upshot with the <URL> failure was that mySQL databases do not actually have passwords. It's the mysql-user accounts have the passwords, and any database they have access to will use their account password.
To add to Eric's grant example, you only need to specify the password for the user when you issue the command the first time for that user. So you don't have to know the password when granting permissions on other databases.
Further you don't need to be system root to create databases (but you might have figured that one out by now).
Lastly I like to suggest that you start reading the MySql reference manual so you can understand how it exactly works; you should have done that long ago when you did set up your first database.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.