MySql常用命令
删除字段:alter table offices drop manager;
select h.id,h.hotel_id,hp.id,hp.hotel_id from hotel_supporting_service as h left join hotel_supporting_service_protocol as hp on hp.src_id = h.id where h.id>6;
show create procedure sys.ps_setup_enable_background_threads;
show procedure status like 'ps_setup_enable_background_threads';
SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_NAME='ps_setup_enable_background_threads';
show triggers;
##select_priv, create_view_priv
SELECT * FROM mysql.user WHERE user='root';
select * from information_schema.VIEWS;
select * from information_schema.TRIGGERS;
SELECT @@AUTOCOMMIT;
SELECT @@tx_isolation;
select * from zcy_develop.vanyar_users where account='339900111111';
select * from zcy_develop.vanyar_orgins_category where org_id = 100013315;
select * from zcy_develop.vanyar_employee where user_id = 100018406;
select * from zcy_develop.vanyar_user_extra where user_id = 100018406;
delete from oauth_code;
delete from oauth_access_token;
select password("**jjhh");
analyze table zcy_develop.vanyar_user_extra;
select * from mysql.user;
SHOW VARIABLES LIKE 'slow_query_log_file';
SHOW STATUS LIKE 'slow_queries';
mysqladmin -u root
password
"newpass"
mysqladmin -u root
password
oldpass
"newpass"
所有大于16M的SQL文件都会报ERROR 2006 (HY000) at line 17128: MySQL server has gone away,我们可以登录MySQL客户端,修改系统变量:
set GLOBAL max_allowed_packet=500*1024*1024;
我们也可以通过修改MySQL配置my.cnf
文件,在最后一行增加max_allowed_packet=500M
就可以了
MySQL配置文件的位置:
- Windows下
C:\ProgamData\MySQL\MySQL Server5.6
- Linux下
/etc/mysql
- Mac下通过brew安装
/usr/local/Cellar/mysql/5.6.23