四、linux-mysql 下MySQL的管理

  1.mysql启动的实质:

      在单实例中,/etc/init.d/mysql start 是一个shell脚本,调用mysqld_safe脚本,最后调用mysqld服务启动mysql。

  2. 关闭mysql有两种方式,mysqladmin  -uroot -poldboy124 shutdown 或者    /etc/init.d/mysql  stop

  3.  对于mysql要多用:help,就像是linux 中的man,help一样。

  4.修改密码两种方式:

     1)mysqladmin   -uroot -poldboy124  password '123'---必须有原密码

     2)update mysql.user  set  password=password(456)  where user='root'  and host='localhost'

  5.密码丢失:

      1)/etc/init.d/mysql stop

      2)  mysqld_safe --skip-grant-tables --user=mysql & (跳过授权页面进行mysql服务开启,即登陆不需要密码)

     3)mysql进行登陆

     4)pdate mysql.user  set  password=password(456)  where user='root'  and host='localhost'

     5)lush  privileges

     6)quit

     7)  mysqladmin -uroot -p124 shutdown

     8)正常方式重新登陆

猜你喜欢

转载自www.cnblogs.com/dangjingwei/p/11404376.html