5

Is there a any way to set password for each database in MySQL server . if there , give some suggestions.

M Khalid Junaid
  • 63,861
  • 10
  • 90
  • 118
R J.
  • 1,522
  • 10
  • 25
  • 40

1 Answers1

6

You cannot set passwords on MySQL databases. You can set passwords for users with privileges granted per database, table, etc.

CREATE USER Syntax

CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass';

GRANT Syntax

GRANT ALL ON db1.* TO 'jeffrey'@'localhost';
GRANT SELECT ON db2.invoice TO 'jeffrey'@'localhost';
GRANT USAGE ON *.* TO 'jeffrey'@'localhost' WITH MAX_QUERIES_PER_HOUR 90;

That should help get you started.

jimp
  • 16,999
  • 3
  • 27
  • 36