易截截图软件、单文件、免安装、纯绿色、仅160KB

修改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命令修改口令,也可通过修改库来更改口令。


相关文档:

如何修改mysql root密码?

1、编辑MySQL配置文件:
 windows环境中:%MySQL_installdir%\my.ini //一般在MySQL安装目录下有my.ini即MySQL的配置文件。
linux环境中:/etc/my.cnf
在[MySQLd]配置段添加如下一行:
skip-grant-tables
保存退出编辑。
2、然后重启MySQL服务
windows环境中:
net stop MySQL
net start MySQL
linux环境中 ......

mysql 常用函数

一、常用字符串函数
1.CONCAT(str1,str2,...)
mysql> ? concat;
mysql> SELECT CONCAT('My', 'S', 'QL');
+-------------------------+
| CONCAT('My', 'S', 'QL') |
+-------------------------+
| MySQL        ......

MYSQL 备忘录

MySQL client programs:
mysql
The command-line tool for interactively entering SQL statements or executing them from a file in batch mode. See Section 4.5.1, “mysql — The MySQL Command-Line Tool”.
mysqladmin
A client that performs administrative operations, such as crea ......

MySQL中增加新用户并对其赋予相应权限的办法

(1)格式:grant select on 数据库.* to 用户名@登录主机 identified by "密码"
 
(2)例1、增加一个用户user_1密码为123,让他可以在任何主机上登录,并对所有数据库有查询、插入、修改、删除的权限。首先用以root用户连入MySQL,然后键入以下命令:
mysql> grant select,insert,update,delete on *.* to use ......

MySQL Administrator无法连接服务器的解决方法

   默认情况下Linux内的mysql数据库mysql.user表内的用户权限只是对localhost即本机才能登陆。所以需要更改权限,否则无法使用Mysql Administrator连接服务器,会发生如下所示的错误:
      MySQL Administrator 1.1.9配置,连接mysql数据库
      Could no ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号