simple question on mysql

Hi to all of you,
I need a confirmation message from you , I need to create a datbase on mysql as reported below :

•      Name:  carlodb
•      User:     admin
•      Character set:    utf8 -- UTF-8 Unicode
•      Collation:             utf8_general_ci

is the sysntax correct ?


mysql> CREATE DATABASE carlodb CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> grant CREATE,INSERT,DELETE,UPDATE,SELECT on carlodb.* to admin@localhost;
mysql> set password for admin = password('adminpassword');
mysql> flush privileges;
mysql> exit


thank you for your support
Carlo
CarloAsked:
Who is Participating?
 
Garry GlendownConsulting and Network/Security SpecialistCommented:
yes, "%" is the wildcard character and should work (make sure you have some sort of firewall in between, or your MySQL server may come under attack from anywhere). You could instead also use something like 'admin'@'192.168.123.%' to limit access to a certain IP subnet ...
0
 
Garry GlendownConsulting and Network/Security SpecialistCommented:
Drop the "set password" line, and add "identified by 'adminpassword' " to the grant command:

grant CREATE,INSERT,DELETE,UPDATE,SELECT on carlodb.* to admin@localhost identified by "adminpassword";

That should be it ... flush privileges ought to be superfluous, that's only necessary when you manually alter internal MySQL tables ...
0
 
Garry GlendownConsulting and Network/Security SpecialistCommented:
(on a side note, I usually put the username and the host in the grant statement in quotation marks ... some versions seemed to have problems when I did not do that ... not exactly sure whether it's necessary with current version, but it works ... so:

grant CREATE,INSERT,DELETE,UPDATE,SELECT on carlodb.* to 'admin'@'localhost' identified by "adminpassword";
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
CarloAuthor Commented:
thank you , can you also confirm that the user admin can access from the machine itself?
if I want to grant the user admin to access to mysql from anywhere the syntax should be


grant CREATE,INSERT,DELETE,UPDATE,SELECT on carlodb.* to 'admin'@'%' identified by "adminpassword";


thank you
0
 
CarloAuthor Commented:
Perfect !!!!!
thank you
0
 
CarloAuthor Commented:
It worked fine!!1
0
 
CarloAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for carlettus's comment #a38350562
Assisted answer: 500 points for Garry-G's comment #a38344853

for the following reason:

It helped
0
 
Garry GlendownConsulting and Network/Security SpecialistCommented:
well, I guess if it worked you might just award points :)
0
 
CarloAuthor Commented:
your suggestion was correct and helped me .
Thank you again
Carlo
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.