我记录的一些mysql使用笔记
修改数据库,允许远程访问 1 2 3 4 5 6 7 8 use mysql; update user set Host='%' where User='root'; (注:有一说是) GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION; flush privileges; # 清缓存 # 确认root的host是否是“%” select host,user from user;
修改数据库 以wordpress修改网址为例(将siteurl字段值设置为http://blog.latelee.org)
1 2 3 4 5 6 7 8 9 10 mysql -uroot -pJJ..** use wordpress0; select * from wp_options where option_name='siteurl'; update wp_options set option_value='http://blog.latelee.org' where option_name='siteurl'; select * from wp_options where option_name='home'; update wp_options set option_value='http://blog.latelee.org' where option_name='home';
查看数据库有哪些表:
查看数据库有哪些字段:
1 2 3 desc wp_comments; 或 describe wp_comments;
清空某一个表:
1 2 delete * from wp_comments; truncate table wp_comments; # 注:测试时发现此语句无法执行
恢复禅道admin密码为123456 1 2 3 use zentao; select * from zt_user where account='admin'; update zt_user set password='e10adc3949ba59abbe56e057f20f883e' where account='admin';
密码在zt_user表中,123456的md5值为e10adc3949ba59abbe56e057f20f883e。其它账号类似。
修改数据库root密码 1 2 3 use mysql; update user set password=password('fuck123456') where user='root' and host='localhost'; flush privileges;