Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 894
  • Last Modified:

Simple MySQL command for Schema Privilages

I am creating a simple webpage that requires me to make users for everyone who needs to login. And they have there own small database that they have god rights to, but nothign else.

Everything works perfectly besides they have no rights to anything. I create the user and they are blank (i create it by editing the mysql db which I know isn't the prefered method.)

It had to be done with PHP so it's via command line.

It has to be something like this right?:
GRANT ALL PRIVILEGES ON SCHEMA andy TO andy@%"
I've done other variations to get syntax correct. Nothing works in Query Browser or via PHP, which is similar.
0
BiSHGoD
Asked:
BiSHGoD
  • 4
  • 3
1 Solution
 
kupra1Commented:
Did you try this:

GRANT ALL ON test.mydb TO 'andy'@'localhost' (assuming test.mydb is ur schema name)
0
 
BiSHGoDAuthor Commented:
Well I don't know the full name of the database.
It says andy. Just like there is a mysql, phpnuke, and test database. How do I know the extension?

Also It has to be from all other hosts % (since it's a webpage and accessed all over right?).
0
 
kupra1Commented:
or use this:

GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost'
IDENTIFIED BY 'password' WITH GRANT OPTION;
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
kupra1Commented:
>>>> Also It has to be from all other hosts % (since it's a webpage and accessed all over right?).

Then use this:
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%'
IDENTIFIED BY 'password' WITH GRANT OPTION;

replace username and password with the right values.
0
 
BiSHGoDAuthor Commented:
It seems *.* would give god access.
Is that right?
It would make sense it is
GRANT ALL PRIVILEGES ON andy.* TO 'andy'@'%'
IDENTIFIED BY 'password' WITH GRANT OPTION;

I tried that I think. I'll try it again and post the error.
0
 
kupra1Commented:
yea.. it should.
0
 
BiSHGoDAuthor Commented:
Error 1133. Can't find any matching row in the user table.

Although in mysql database and the user table 'andy' is there. Password is correct.

What I typed was:

GRANT ALL PRIVILEGES ON andy.* TO 'andy'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

As one long string into the Query Browser. Hit execute and that error happens.
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now