Home  >  Article  >  Database  >  linux下配置mysql

linux下配置mysql

WBOY
WBOYOriginal
2016-06-07 15:47:051218browse

环境是Oracle Enterprise Linux 6 先安装rpm包然后启动服务 chkconfig mysqld on service mysqld restart 设置用户的密码 #/usr/bin/mysqladmin -u root password yourpassword 如果以后忘记mysql的root密码,那么就这样解决: vi /etc/my.cnf 在[mysqld]的

环境是Oracle Enterprise Linux 6

先安装rpm包然后启动服务
chkconfig mysqld on
service mysqld restart

设置用户的密码
#/usr/bin/mysqladmin -u root password yourpassword


如果以后忘记mysql的root密码,那么就这样解决:
vi /etc/my.cnf
在[mysqld]的段中加上一句skip-grant-tables
重启服务service mysqld restart
修改密码:
mysql -u root
use mysql;
UPDATE user SET Password = password ( 'test1234' ) WHERE User = 'root';

然后再删除/etc/my.cnf中的skip-grant-tables
然后service mysqld restart

这样root密码就变成test1234了

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn