MySQL随手写!
1.导出MySQL某个数据库中的表到指定目录格式为.xls
[root@centos ~]# mysql -u root -p123456 -e "select * from share2;" class1 > /root/mysql.xls #mysql连接数据库 #-u root用户 #-p root密码 #-e 导出sql语句结果 #sql语句 #数据库名 #>输入指定目录
2.MYSQL跳过登陆密码验证!
[root@VM-centos ~]# vi /etc/my.cnf ###进去my配置文件 skip-grant-tables ###将配置参数写在配置文件尾部即可 [root@VM-centos ~]# systemctl restart mysqld ###重启mysql服务
3.MySQL修改密码其中一种方式
mysql> use mysql;
mysql> update mysql.user set authentication_string=password('netpassword') where user='root' and Host ='localhost';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
步骤 1):输入use mysql;命令连接权限数据库。
步骤 2):输入命令update mysql.user set authentication_string=password('密码') where user='用户名' and Host ='localhost';
步骤 3):输入 flush privileges; 命令刷新权限。