您好,欢迎来到频厘教育网。
搜索
您的当前位置:首页mysql安装及root密码初始化_MySQL

mysql安装及root密码初始化_MySQL

来源:频厘教育网


bitsCN.com
安装mysql [root@sample ~]# yum -y install mysql-server  ← 安装MySQL[root@sample ~]# yum -y install php-mysql  ← 安装php-mysql配置mysql [root@sample ~]# /etc/init.d/mysqld stop 停止mysql服务[root@sample ~]# vim /etc/my.cnf mysql服务的配置文件[mysqld] datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockuser=mysql# Disabling symbolic-links is recommended to prevent assorted security risksskip-grant-tables #添加这句话,这时候登入mysql就不需要密码symbolic-links=0 [root@sample ~]# /etc/init.d/mysqld start 启动mysql服务[root@sample ~]# mysql 登入mysqlmysql> USE mysql ;mysql> UPDATE user SET Password = password(‘new-password‘) WHERE User = ’root’ ;mysql> flush privileges ; mysql> quit在把 /etc/my.cnf 中 skip-grant-tables 注释了,恢复配置文件原样。 [root@sample ~]# /etc/init.d/mysqld restart 启动mysql服务 [root@sample ~]# mysql -u root -p 输入密码 修改密码 原来的帐号:root,密码:root,修改成 fire [root@sample ~]# mysqladmin -u root -p password fire Enter password:
bitsCN.com

Copyright © 2019- plrc.com.cn 版权所有

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务