标签:接收 设置密码 版权 查看 启动 服务器端 rom 集中 soft
MySQL初始化以及客户端工具的使用
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
1 mysql> select user,host,password from user; 2 +-------------+-------------+-------------------------------------------+ 3 | user | host | password | 4 +-------------+-------------+-------------------------------------------+ 5 | root | localhost | | 6 | root | yinzhengjie | | 7 | root | 127.0.0.1 | | 8 | | localhost | | 9 | | yinzhengjie | | 10 | yinzhengjie | 10.%.%.% | *C260A4F79FA905AF65142FFE0B9A14FE0E1519CC | 11 +-------------+-------------+-------------------------------------------+ 12 6 rows in set (0.00 sec) 13 14 mysql> 15 mysql> 16 mysql> 17 mysql> 18 mysql> drop user ""@localhost; 19 Query OK, 0 rows affected (0.01 sec) 20 21 mysql> drop user ""@yinzhengjie; 22 Query OK, 0 rows affected (0.00 sec) 23 24 mysql> select user,host,password from user; 25 +-------------+-------------+-------------------------------------------+ 26 | user | host | password | 27 +-------------+-------------+-------------------------------------------+ 28 | root | localhost | | 29 | root | yinzhengjie | | 30 | root | 127.0.0.1 | | 31 | yinzhengjie | 10.%.%.% | *C260A4F79FA905AF65142FFE0B9A14FE0E1519CC | 32 +-------------+-------------+-------------------------------------------+ 33 4 rows in set (0.00 sec) 34 35 mysql>
1 第一种方式: 2 mysql > set password for username@host = password( ‘your_password‘); 3 第二种方法 4 mysql > update user set password = password(‘your_password‘) where user = ‘root‘; 5 mysql > flush peivileges; 6 第三种方式: 7 [root@yinzhengjie ~]#mysqladmin -u UserName -h Hot password ‘new_password‘ -p 8 [root@yinzhengjie ~]#mysqladmin -u UserName -h Host -p flush-privileges
1 [root@yinzhengjie ~]# mysqladmin create yinzhengjiedb #创建一个叫yinzhengjiedb的数据库。 2 [root@yinzhengjie ~]# mysql -e ‘show databases;‘ #我们可以用mysql的-e选项来进行验证是否创建成功、 3 +--------------------+ 4 | Database | 5 +--------------------+ 6 | information_schema | 7 | mysql | 8 | test | 9 | yinzhengjie | 10 | yinzhengjiedb | 11 +--------------------+ 12 [root@yinzhengjie ~]#
2.删除数据库
1 [root@yinzhengjie ~]# mysql -e ‘show databases;‘ 2 +--------------------+ 3 | Database | 4 +--------------------+ 5 | information_schema | 6 | mysql | 7 | test | 8 | yinzhengjie | 9 | yinzhengjiedb | 10 +--------------------+ 11 [root@yinzhengjie ~]# mysqladmin drop yinzhengjiedb 12 Dropping the database is potentially a very bad thing to do. 13 Any data stored in the database will be destroyed. 14 15 Do you really want to drop the ‘yinzhengjiedb‘ database [y/N] y #此处我们需要交互式输入一个y。 16 Database "yinzhengjiedb" dropped 17 [root@yinzhengjie ~]# mysql -e ‘show databases;‘ 18 +--------------------+ 19 | Database | 20 +--------------------+ 21 | information_schema | 22 | mysql | 23 | test | 24 | yinzhengjie | 25 +--------------------+ 26 [root@yinzhengjie ~]#
标签:接收 设置密码 版权 查看 启动 服务器端 rom 集中 soft
原文地址:http://www.cnblogs.com/yinzhengjie/p/7834763.html