Linux Centos-6 Mysql修改密码 不需要输入原密码
2016-06-16 12:59
441 查看
Linux Centos-6 Mysql修改密码 不需要输入原密码
首先需要配置 my.cnf 文件 在其中 加入一行【mysqld】下
skip-grant-tables
my.cnf 一般是在 etc目录下
然后就是修改密码
在 终端 输入 mysql -u root -p
[root@guhaotechnology ~]# mysql -u root -p Enter password:
会出现让你键入密码 由于我们修改过配置文件此处不用任何输入直接回车即可
接下来是 进入mysql 还需要选择下
use mysql;
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> update user set password("root") where user='root'; 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 '("root") where user='root'' at line 1 mysql> update user set password=PASSWORD("root") where user='root'; Query OK, 3 rows affected (0.07 sec) Rows matched: 3 Changed: 3 Warnings: 0 mysql> exit Bye
重启mysql使修改生效
[root@guhaotechnology ~]# service mysqld restart Stopping mysqld: [ OK ] Starting mysqld: [ OK ]
这样基本问题就解决了
相关文章推荐
- MySQL中的integer 数据类型
- Linux socket 初步
- MySQL存储过程
- android wifi 无线调试
- Linux Kernel 4.0 RC5 发布!
- linux lsof详解
- linux 文件权限
- Linux 执行数学运算
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- mysql中int、bigint、smallint 和 tinyint的区别与长度
- mysql load data 导出、导入 csv