Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mysql -u root -p
- CREATE USER 'bill'@'%' IDENTIFIED BY 'passpass';
- grant all privileges on *.* to 'bill'@'%' with grant option;
- mysql -u bill -p
- ''@'localhost'
- 'bill'@'%'
- 'bill'@'%'
- ~$ mysql -u root -p
- Enter Password:
- mysql> grant all privileges on *.* to bill@localhost identified by 'pass' with grant option;
- mysql -u bill -p
- ERROR 1045 (28000): Access denied for user 'bill'@'localhost' (using password: YES)
- CREATE USER bill@localhost IDENTIFIED BY 'passpass';
- grant all privileges on *.* to bill@localhost with grant option;
- mysql -u bill -p -hmydb@mydomain.com
- mysql -u bill -p -h10.1.2.30
- mysql -u bill -p -h127.0.0.1 --protocol=TCP
- SELECT USER(),CURRENT_USER();
- mysql> select user,host from mysql.user;
- +---------+-----------+
- | user | host |
- +---------+-----------+
- | lwdba | % |
- | mywife | % |
- | lwdba | 127.0.0.1 |
- | root | 127.0.0.1 |
- | lwdba | localhost |
- | root | localhost |
- | vanilla | localhost |
- +---------+-----------+
- 7 rows in set (0.00 sec)
- mysql> grant all on *.* to x@'%';
- Query OK, 0 rows affected (0.02 sec)
- mysql> select user,host from mysql.user;
- +---------+-----------+
- | user | host |
- +---------+-----------+
- | lwdba | % |
- | mywife | % |
- | x | % |
- | lwdba | 127.0.0.1 |
- | root | 127.0.0.1 |
- | lwdba | localhost |
- | root | localhost |
- | vanilla | localhost |
- +---------+-----------+
- 8 rows in set (0.00 sec)
- mysql> update mysql.user set user='' where user='x';
- Query OK, 1 row affected (0.00 sec)
- Rows matched: 1 Changed: 1 Warnings: 0
- mysql> flush privileges;
- Query OK, 0 rows affected (0.01 sec)
- mysql> select user,host from mysql.user;
- +---------+-----------+
- | user | host |
- +---------+-----------+
- | | % |
- | lwdba | % |
- | mywife | % |
- | lwdba | 127.0.0.1 |
- | root | 127.0.0.1 |
- | lwdba | localhost |
- | root | localhost |
- | vanilla | localhost |
- +---------+-----------+
- 8 rows in set (0.00 sec)
- mysql>
- C:MySQL_5.5.12>mysql -urol -Dtest -h127.0.0.1 --protocol=TCP
- Welcome to the MySQL monitor. Commands end with ; or g.
- Your MySQL connection id is 12
- Server version: 5.5.12-log MySQL Community Server (GPL)
- Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
- Oracle is a registered trademark of Oracle Corporation and/or its
- affiliates. Other names may be trademarks of their respective
- owners.
- Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
- mysql> select user(),current_user();
- +---------------+----------------+
- | user() | current_user() |
- +---------------+----------------+
- | rol@localhost | @% |
- +---------------+----------------+
- 1 row in set (0.00 sec)
- mysql>
- mysql -u mike -p mypass
- mysql -u mike -pmypass
- [client]
- user = myusername
- password = "mypassword" # <----------------------- VERY IMPORTANT (quotes)
- host = localhost
- ERROR 1045 (28000): Access denied for user 'sonar'@'localhost' (using password: YES)
- alm-lt-test.xyz.com
- mysql -u sonar -p -halm-lt-test.xyz.com
- mysql -u sonar -p -h101.33.65.94
- mysql -u sonar -p -h127.0.0.1 --protocol=TCP
- mysql -u sonar -p -h172.27.59.54 --protocol=TCP
- GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar';
- GRANT ALL ON sonar.* TO 'sonar'@'alm-lt-test.xyz.com' IDENTIFIED BY 'sonar';
- GRANT ALL ON sonar.* TO 'sonar'@'127.0.0.1' IDENTIFIED BY 'sonar';
- GRANT ALL ON sonar.* TO 'sonar'@'172.27.59.54' IDENTIFIED BY 'sonar';
- bind-address = 127.0.0.1
- mysql -u debian-sys-maint -p
- SQL SECURITY DEFINER
- SQL SECURITY INVOKER
- CREATE USER 'bill'@'%' IDENTIFIED BY 'passpass';
- CREATE USER 'bill'@'localhost' IDENTIFIED BY 'passpass';
- mysql> select user,host from mysql.user;
- +---------------+----------------------------+
- | user | host |
- +---------------+----------------------------+
- | bill | % | <=== created by first
- | root | 127.0.0.1 |
- | root | ::1 |
- | root | localhost |
- | bill | localhost | <=== created by second
- +---------------+----------------------------+
- mysql -u bill -p
- ERROR 1045 (28000): Access denied for user 'bill'@'localhost' (using password: YES)
- CREATE USER 'bill'@'localhost' IDENTIFIED BY 'passpass';
- grant all privileges on . to 'bill'@'localhost' with grant option;
- $ mysql -usomeuser -p's0mep@$$w0Rd'
- $ mysql -usomeuser -p
- Enter password:
- Welcome to the MySQL monitor. Commands end with ; or g.
- Your MySQL connection id is 191
- Server version: 5.5.46-0ubuntu0.14.04.2 (Ubuntu)
- Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
- Oracle is a registered trademark of Oracle Corporation and/or its
- affiliates. Other names may be trademarks of their respective
- owners.
- Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
- mysql>
- UPDATE user SET plugin='mysql_native_password' WHERE user='foo';
- FLUSH PRIVILEGES;
- FLUSH PRIVILEGES;
- CREATE USER bill@localhost IDENTIFIED BY 'passpass';
- grant all privileges on *.* to bill@localhost with grant option;
- FLUSH PRIVILEGES;
- UPDATE mysql.user SET user='xxxx', password=PASSWORD('xxxx') WHERE user='';
- FLUSH PRIVILEGES;
Add Comment
Please, Sign In to add comment