Chinaunix

标题: mysql用户的问题?麻烦路过的告之一下!多谢! [打印本页]

作者: Antiy7    时间: 2008-12-10 23:29
标题: mysql用户的问题?麻烦路过的告之一下!多谢!
我是通过如下方法安装mysql的,系统是ubuntu8.04:
在新立得软件包管理器中选择 编辑--使用任务分组标记软件包

在打开的窗口中 勾选 LAMP SERVER 然后确定。

在主窗口中 点击绿色的对号 应用 按钮

好了 。接下来就是等待...等待新立得 自动下载安装完。

中间会有一次提示输入mysql的root用户的密码

问题是现在我在shell终端下直接键入mysql就可以进到mysql>这个模式里,,没有提示我输入密码?。
mysql> select user();
这时应该显示的是我的mysql的管理员吧?
但不是root .
也就是说中间会有一次提示输入mysql的root用户的密码 ,里面提到的那个root是我现在看到的用户吧?

但是我修改那个用户的密码又改不掉,命令:
mysqladmin -uwangcai password asdf
作者: ruochen    时间: 2008-12-11 08:48
mysql> select user();
mysql> select user,host,password from mysql.user;
mysql> select version();



把上面的贴出来吧
作者: ruochen    时间: 2008-12-11 08:49
#mysql -u root -p
输入你安装的时候的密码看看
然后
mysql> select user,host,password from mysql.user;
作者: Antiy7    时间: 2008-12-11 11:48
  1. Antiy7@ubuntu8.04:~$ mysql -u root -p
  2. Enter password:
  3. Welcome to the MySQL monitor.  Commands end with ; or \g.
  4. Your MySQL connection id is 9
  5. Server version: 5.0.51a-3ubuntu5.4 (Ubuntu)

  6. Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

  7. mysql> select user,host,password from mysql.user;
  8. +------------------+----------------+-------------------------------------------+
  9. | user             | host           | password                                  |
  10. +------------------+----------------+-------------------------------------------+
  11. | root             | localhost      | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
  12. | root             | jijunxu-ubuntu | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
  13. | root             | 127.0.0.1      | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
  14. |                  | localhost      |                                           |
  15. |                  | jijunxu-ubuntu |                                           |
  16. | debian-sys-maint | localhost      | *8605DD8C7E41DD0DC68C9E9F8879B1E810B7B7A1 |
  17. +------------------+----------------+-------------------------------------------+
  18. 6 rows in set (0.00 sec)

  19. mysql>
复制代码


谢谢ruochen!
问题一目了然了!
mysql用户是root,


但是如果我这样输入:
  1. Antiy7@ubuntu8.04:~$ mysql   //这个地方没有指定用户,那就是用当前用户了把?
  2. Welcome to the MySQL monitor.  Commands end with ; or \g.
  3. Your MySQL connection id is 10
  4. Server version: 5.0.51a-3ubuntu5.4 (Ubuntu)

  5. Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

  6. mysql> select user();
  7. +-------------------+
  8. | user()            |
  9. +-------------------+
  10. | Antiy7@localhost |   //这个地方显示当前用户的名字,而不是root!问题是我如何知道当前数据库有几个用户呢?
  11. +-------------------+
  12. 1 row in set (0.00 sec)

  13. mysql>
复制代码



麻烦各位看看!

[ 本帖最后由 Antiy7 于 2008-12-11 19:45 编辑 ]
作者: ruochen    时间: 2008-12-11 14:06
如何知道当前数据有几个用户呢------------没看懂!!!


| localhost                                 
| jijunxu-ubuntu
看看手册了解下这两个是什么意思吧
作者: Antiy7    时间: 2008-12-11 19:47
原帖由 ruochen 于 2008-12-11 14:06 发表
如何知道当前数据有几个用户呢------------没看懂!!!


| localhost                                 
| jijunxu-ubuntu
看看手册了解下这两个是什么意思吧

漏写了,当前数据库有几个用户?
就是说有几个帐户可以管理mysql数据库呢?我用root可以,用Antiy7这帐户也可以?
作者: yueliangdao0608    时间: 2008-12-11 21:50
好像LZselect的跟你要改密码的用户不一样
作者: ruochen    时间: 2008-12-12 08:38
原帖由 Antiy7 于 2008-12-11 19:47 发表

漏写了,当前数据库有几个用户?
就是说有几个帐户可以管理mysql数据库呢?我用root可以,用Antiy7这帐户也可以?




mysql>use mysql
mysql>desc user;
mysql>select * from user;
作者: ruochen    时间: 2008-12-12 08:39
还有单个数据库的管理除root外还是都分开的好


看手册grant的语法和安全部分,都有提示的
mysql>grant all privileges  *****    with grant option;



还有information_schema库中表的相关信息

[ 本帖最后由 ruochen 于 2008-12-12 08:46 编辑 ]
作者: Antiy7    时间: 2008-12-12 08:48
多谢两位,
还想问问,我的系统是ubuntu8.04
  1. jijunxu@ubuntu8:~$ mysql -uroot -p
  2. Enter password:
  3. Welcome to the MySQL monitor.  Commands end with ; or \g.
  4. Your MySQL connection id is 30
  5. Server version: 5.0.51a-3ubuntu5.4 (Ubuntu)

  6. Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

  7. mysql> show databases;
  8. +--------------------+
  9. | Database           |
  10. +--------------------+
  11. | information_schema |
  12. | mysql              |
  13. | school             |
  14. +--------------------+
  15. 3 rows in set (0.00 sec)

  16. mysql> exit
  17. Bye
  18. jijunxu@ubuntu8:~$ mysql
  19. Welcome to the MySQL monitor.  Commands end with ; or \g.
  20. Your MySQL connection id is 31
  21. Server version: 5.0.51a-3ubuntu5.4 (Ubuntu)

  22. Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

  23. mysql> show databases;
  24. +--------------------+
  25. | Database           |
  26. +--------------------+
  27. | information_schema |   //直接登录后这个地方只显示这一个数据库,请问这个数据库是做什么的?mysql信息?
  28. +--------------------+
  29. 1 row in set (0.00 sec)

  30. mysql> exit
  31. Bye
  32. jijunxu@ubuntu8:~$
复制代码





欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2