PDA

View Full Version : MySQL


alexillsley
18th April 2007, 09:33
Hi,
Please can you help me fix the code to create a user & database, it just gives me an error. Heres the code:
CREATE USER 'testing'@ '%' IDENTIFIED BY 'test';

GRANT USAGE ON * . * TO 'testing'@ '%' IDENTIFIED BY 'test' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;

CREATE DATABASE `testing` ;

GRANT ALL PRIVILEGES ON `testing` . * TO 'test'@ '%';

Heres the error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''%' IDENTIFIED BY 'test'' at line 1
Please can you help me fix the SQL,
Alex

falko
19th April 2007, 14:33
Take a look here: http://dev.mysql.com/doc/refman/5.0/en/grant.html
You don't need the CREATE statement because the user is created automatically when you run a GRANT command.

alexillsley
22nd April 2007, 12:42
Hi,
Thanks, i got it working with this:
GRANT ALL PRIVILEGES ON testing.* TO 'test'@'localhost'
IDENTIFIED BY 'test' WITH GRANT OPTION

How can i hide the database called "information_schema" ?

Thanks,
Alex

falko
23rd April 2007, 18:11
Take a look here: http://forums.mysql.com/read.php?101,85251,86464#msg-86464

alexillsley
23rd April 2007, 18:24
Thanks it work perfectly:)

I was also wondering, how can i stop users from creating databases, in phpmyadmin when you create a database it says:
#1044 - Access denied for user 'mysql2_test'@'%' to database 'test'

It still stops the user but however if you create a user with a garnt option in phpmyadmin, it has a little cross next to the create database option in phpmyadmin, any ideas how to do this?

Thanks,
Alex

falko
24th April 2007, 19:48
It still stops the user but however if you create a user with a garnt option in phpmyadmin, it has a little cross next to the create database option in phpmyadmin, any ideas how to do this?

Thanks,
Alex
Simply do not grant the CREATE priviledge to that user.

alexillsley
25th April 2007, 01:26
The global create privilege is off for this user, the only create option is on the users database:confused: This happens also with users created with ispconfig