linux下修改默认MYSQL的root管理密码

Linux MySQL的几个重要目录

1、数据库目录

/var/lib/mysql/

 2、配置文件,mysql.server命令及配置文件

/usr/share /mysql

 3、相关命令,mysqladmin mysqldump等命令

/usr/bin

 4、启动脚本,启动脚本文件mysql的目录

/etc/rc.d/init.d/

 5、修改root默认密码

[root@test1 local]# /usr/bin/mysqladmin -u root password 123456

 6、测试是否修改成功

[root@test1 local]# mysql
ERROR 1045: Access denied for user: 'root@localhost' (Usingpassword: NO)

 7、用修改后的密码登录

[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>

 8、linux启动

MySQL安装完成后启动文件mysql在/etc/init.d目录下,在需要启动时运行下面命令即可。

[root@test1 init.d]# /etc/init.d/mysql start

 另外安装程序把MySQL安装成了service,所以在任何目录下都可以用:

service mysql start

 启动LinuxMySQL

9、停止

/usr/bin/mysqladmin -u root -p shutdown

 或者

service mysql stop

10、自动启动

1)察看mysql是否在自动启动列表中

[root@test1 local]# /sbin/chkconfig –list

  2)把Linux MySQL添加到你系统的启动服务组里面去

[root@test1 local]# /sbin/chkconfig – add mysql

 3)把Linux MySQL从启动服务组里面删除。

[root@test1 local]# /sbin/chkconfig – del mysql

 

猜你喜欢

转载自kent-mu.iteye.com/blog/2213741
今日推荐