修改MySQL数据库登陆密码的方法
MySQL默认没有密码,安装完毕增加密码的重要性是不言而喻的。
(1)命令
/usr/bin/mysqladmin -u root –p ‘old-password’ password 'new-password'
格式:mysqladmin -u用户名 -p旧密码 password 新密码
(2)例子
例1:给root加个密码123456。
键入以下命令 :
[root@test1 local]# /usr/bin/mysqladmin -u root password 123456
注:因为开始时root没有密码,所以-p旧密码一项就可以省略了。
(3)测试是否修改成功
1)不用密码登录
[root@test1 local]# mysql
ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO) 显示错误,说明密码已经修改。
2)用修改后的密码登录
[root@test1 local]# mysql -u root -p
Enter password: (输入修改后的密码123456)
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 4.0.16-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
成功!
这是通过mysqladmin命令修改口令,也可通过修改库来更改口令。
相关文档:
http://javeye.javaeye.com/blog/558093
我们知道,group by可以将sql查询结果按照group by后面列进行分类显示。比如:
Sql代码
select
columnA,columnB
from
table
group
by
columnA,columnB
select columnA,columnB from table group by columnA,colum ......
etting up OpenLDAP with MySQL backend
用mysql作后台数据库安装openldap
author: TBONIUS
OpenLDAP is an X.500 Lightweight Directory Access Server used for
centralized authentication and directory lookups. ......
注意:MySQL中每个命令后都要以分号;结尾。
(1)显示数据库
mysql> show databases;
+----------+
| Database |
+----------+
| mysql |
| test |
+----------+
2 rows in set (0.04 sec)
Mysql刚安装完有两个数据库:mysql和test。其中,mysql库非常重要,它里面有MyS ......
(1)格式:grant select on 数据库.* to 用户名@登录主机 identified by "密码"
(2)例1、增加一个用户user_1密码为123,让他可以在任何主机上登录,并对所有数据库有查询、插入、修改、删除的权限。首先用以root用户连入MySQL,然后键入以下命令:
mysql> grant select,insert,update,delete on *.* to use ......