mysql CREATE USER fedya mysql SET PASSWORD FOR fedya PASSWORD abc mysq

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
mysql> CREATE USER 'fedya'@'%';
mysql> SET PASSWORD FOR 'fedya'@'%' = PASSWORD('abc');
mysql> CREATE USER 'vasya'@'%' IDENTIFIED BY 'abc';
mysql> GRANT ALL ON bookshop.* TO 'fedya'@'%';
mysql> GRANT SELECT,UPDATE ON world.city TO 'vasya'@'%';
C:\>mysql -ufedya -p
Enter password: ***
Welcome to the MySQL monitor. Commands end with ; or \g.
mysql> INSERT INTO `bookshop`.`books` (`title`, `author`) VALUES ('Новая книга 53', 'Автор');
C:\>mysql -uvasya -p
Enter password: ***
Welcome to the MySQL monitor. Commands end with ; or \g.
mysql> show tables;
+-----------------+
| Tables_in_world |
+-----------------+
| city |
+-----------------+
C:\>mysql -uroot -p
mysql> SELECT user, host, password FROM mysql.user;
mysql> REVOKE ALL PRIVILEGES ON bookshop.* FROM 'fedya'@'%';