MySQL常用操作
《MySQL常用操作》要点: 创建mysql用户和数据表 create database testcom; grant all on testcom.* to 'cxf'@'localhost' identified by 'cxf'; MySQL的密码重置 设置root密码为123456 mysql -uroot password '123456' vim /etc/my.cnf 在最后面加一条 skip-grant 不去授权 登录mysql重置密码,重置后要把skip-grant去掉 use mysql; update user set password=password('123456') where user='root'; 刷新磁盘:flush privileges(也可以重启) mysql登录 mysql -uroot -h127.0.0.1 -P3306 -p123456 授权192.168.31.101远程登录数据库 grant all on *.* to 'root'@'192.168.31.101' identified by '123456' with grant option (授权为超级用户) mysql -uroot -h192.168.31.101 -P3306 -p123456 mysql -uroot -S /tmp/mysql.sokt mysql的备份与恢复 库备份命令 mysqldump -uroot -p123456 discuz > /www/mysql_bak/discuz.sql 库恢复命令 mysql -uroot -p123456 discuz < /www/mysql_bak/discuz.sql 表备份命令 mysqldump -uroot -p123456 discuz pre_forum_post > /www/mysql_bak/pre_forum_post.sql 表恢复命令 mysql -uroot -p123456 discuz < /www/mysql_bak/pre_forum_post.sql 指定字符集备份恢复 mysqldump -uroot --default-character-set=utf8 -p123456 discuz > /www/mysql_bak/discuz.sql mysql -uroot --default-character-set=utf8 -p123456 discuz < /www/mysql_bak/pre_forum_post.sql 欢迎参与《MySQL常用操作》讨论,分享您的想法,编程之家PHP学院为您提供专业教程。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |