[root@dyw219 ~]# ssh root@kvm8.deyu.wang root@kvm8.deyu.wang's password: Last login: Sat Dec 6 09:45:29 2014 from 192.168.122.1 [root@kvm8 ~]#
[root@kvm8 ~]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 115 Server version: 5.5.38 MySQL Community Server (GPL) by Remi Copyright (c) 2000, 2014, 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> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed
mysql> show tables; +---------------------------+ | Tables_in_mysql | +---------------------------+ | columns_priv | | db | | event | | func | | general_log | | help_category | | help_keyword | | help_relation | | help_topic | | host | | ndb_binlog_index | | plugin | | proc | | procs_priv | | proxies_priv | | servers | | slow_log | | tables_priv | | time_zone | | time_zone_leap_second | | time_zone_name | | time_zone_transition | | time_zone_transition_type | | user | +---------------------------+ 24 rows in set (0.00 sec)
mysql> select column_name from information_schema.columns where table_name='user'; +------------------------+ | column_name | +------------------------+ | Host | | User | | Password | | Select_priv | | Insert_priv | | Update_priv | | Delete_priv | | Create_priv | | Drop_priv | | Reload_priv | | Shutdown_priv | | Process_priv | | File_priv | | Grant_priv | | References_priv | | Index_priv | | Alter_priv | | Show_db_priv | | Super_priv | | Create_tmp_table_priv | | Lock_tables_priv | | Execute_priv | | Repl_slave_priv | | Repl_client_priv | | Create_view_priv | | Show_view_priv | | Create_routine_priv | | Alter_routine_priv | | Create_user_priv | | Event_priv | | Trigger_priv | | Create_tablespace_priv | | ssl_type | | ssl_cipher | | x509_issuer | | x509_subject | | max_questions | | max_updates | | max_connections | | max_user_connections | | plugin | | authentication_string | +------------------------+ 42 rows in set (0.00 sec)
mysql> INSERT INTO user (host,user,password,select_priv,insert_priv,update_priv)
-> VALUES ('localhost', 'dywang', PASSWORD('123qwe'), 'Y', 'Y', 'Y');
Query OK, 1 row affected, 3 warnings (0.04 sec)
mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.11 sec)
mysql> select host,user,password from user where user='dywang'; +-----------+--------+-------------------------------------------+ | host | user | password | +-----------+--------+-------------------------------------------+ | localhost | dywang | *050376F3855A67F5E2C6514FD3130B31006C1276 | +-----------+--------+-------------------------------------------+ 1 row in set (0.00 sec)
mysql> exit Bye
[root@kvm8 ~]# mysql -udywang -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 116 Server version: 5.5.38 MySQL Community Server (GPL) by Remi Copyright (c) 2000, 2014, 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>
mysql> exit Bye