• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 577
  • Last Modified:

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
0
carlettus
Asked:
carlettus
  • 5
  • 4
1 Solution
 
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
 
carlettusAuthor 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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
 
carlettusAuthor Commented:
Perfect !!!!!
thank you
0
 
carlettusAuthor Commented:
It worked fine!!1
0
 
carlettusAuthor 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
 
carlettusAuthor Commented:
your suggestion was correct and helped me .
Thank you again
Carlo
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

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