Web lists-archives.com

Re: Need a little admin help




Hello Steve,

On 8/27/2015 9:11 PM, Steve Matzura wrote:
I have a Wordpress user who is setting up a Website and says he can't
connect to his database. Both I and the Wordpress admin are new to
this, so I've probably done something wron when I set him up
initiallyg.

Once I connected to SQL as the SQL admin, I used the following
commands to set up the new user's access. In the commands below, I
used my name as for user and database names:

CREATE DATABASE steve_db;
GRANT ALL PRIVILEGES ON steve_db.* TO "steve"@"localhost"
     -> IDENTIFIED BY "steve_pw";
FLUSH PRIVILEGES;

All commands worked successfully.

To figure out what I did wrong, I need to know how to list all SQL
users and what databases they have access to, and if I discover I've
connected a user to a wrong database, how to correct this--do I delete
the user and database and start it all over, or is it easier to modify
wrong things than to replace them? Whatever I do, including deleting
everything, is OK, since the only things I'm doing with SQL at this
time have to do with Postfix, and I certainly know enough not to touch
those.

As always, thanks in advance.


Unless that user is going to terminal into that host server before trying to start their MySQL session, the account you created is not going to work. The host pattern "@localhost" only authenticates users that are appear as if they are connecting from within the host machine, itself. If this other user is attempting to connect to his database from some other location, you will need a different host pattern to allow that user to authenticate.

To see what privileges an account has you would use the "SHOW GRANTS FOR ..." command. Any account can issue a SHOW GRANTS command (without any user name or FOR keyword) to see their own privileges.


Additional reading:
http://dev.mysql.com/doc/refman/5.6/en/account-names.html
http://dev.mysql.com/doc/refman/5.6/en/show-grants.html


Does that give you the details you need to create a second account with the appropriate host pattern?

--
Shawn Green
MySQL Senior Principal Technical Support Engineer
Oracle USA, Inc. - Integrated Cloud Applications & Platform Services
Office: Blountville, TN

Become certified in MySQL! Visit https://www.mysql.com/certification/ for details.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql