免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2401 | 回复: 7
打印 上一主题 下一主题

mysql装好后,默认应该有个用户的吧? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-03-11 15:19 |只看该作者 |倒序浏览
是哪个用户呢?

论坛徽章:
0
2 [报告]
发表于 2011-03-11 15:20 |只看该作者
要不然的话,MySql数据库装好后,岂不是谁都连不上,怎么用啊?

论坛徽章:
0
3 [报告]
发表于 2011-03-11 15:43 |只看该作者
本帖最后由 TOADLover 于 2011-03-11 15:53 编辑

杯具啊。

[root@MySQLServer ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 19 to server version: 4.1.22

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

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 database
    -> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1
mysql> show databases;
+----------+
| Database |
+----------+
| abccs    |
| mysql    |
| test     |
+----------+
3 rows in set (0.00 sec)

mysql> grant all on db.* to 'root'@'%' identified by 'root'
    -> ;
Query OK, 0 rows affected (0.11 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye
[root@MySQLServer ~]# mysql -uroot -proot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@MySQLServer ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 21 to server version: 4.1.22

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

mysql> select user();
+----------------+
| user()         |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

mysql>

论坛徽章:
0
4 [报告]
发表于 2011-03-11 15:53 |只看该作者
本帖最后由 TOADLover 于 2011-03-11 16:13 编辑

用root连Mysql时,不需要指定用户名和密码。。。

mysql> show tables
    -> ;
ERROR 1046 (3D000): No database selected
mysql> use test
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_test |
+----------------+
| t              |
| tbl            |
+----------------+
2 rows in set (0.00 sec)

mysql>

论坛徽章:
20
CU大牛徽章
日期:2013-04-17 11:48:26羊年新春福章
日期:2015-03-10 22:39:202015年中国系统架构师大会
日期:2015-06-29 16:11:282015亚冠之平阳省
日期:2015-07-31 09:19:042015七夕节徽章
日期:2015-08-21 11:06:17IT运维版块每日发帖之星
日期:2015-09-30 06:20:002015亚冠之柏太阳神
日期:2015-10-19 20:29:5915-16赛季CBA联赛之天津
日期:2016-11-29 14:03:4315-16赛季CBA联赛之北控
日期:2016-12-24 20:51:492015年辞旧岁徽章
日期:2015-03-03 16:54:15双鱼座
日期:2015-01-12 20:58:532014年中国系统架构师大会
日期:2014-10-14 15:59:00
5 [报告]
发表于 2011-03-11 16:45 |只看该作者
在Linux下面,默认用户为root

论坛徽章:
8
综合交流区版块每周发帖之星
日期:2015-12-02 15:03:53数据库技术版块每日发帖之星
日期:2015-10-02 06:20:00IT运维版块每日发帖之星
日期:2015-10-02 06:20:00IT运维版块每日发帖之星
日期:2015-09-14 06:20:00金牛座
日期:2014-10-10 11:23:34CU十二周年纪念徽章
日期:2013-10-24 15:41:34酉鸡
日期:2013-10-19 10:17:1315-16赛季CBA联赛之北京
日期:2017-03-06 15:12:44
6 [报告]
发表于 2011-03-11 19:14 |只看该作者
先看看手册吧

论坛徽章:
0
7 [报告]
发表于 2011-03-12 21:37 |只看该作者
root

论坛徽章:
0
8 [报告]
发表于 2011-03-13 00:17 |只看该作者
默认用户有好多好多,有3,4个吧。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP