备份数据库指令

mysql备份数据库
mysqldump -u root -p emdb > /home/em/2018-1-30-2-emdb.sql
emdb:数据库名称

mysql查询死锁并解锁
select * from information_schema.innodb_trx;

SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;
–删除进程
kill 113012;

/*删除某个字段的(create_time)重复数据,只保留一条
* delete from user_deduction_log where id not in
(select minid from (select min(id) as minid from user_deduction_log group by create_time) b);
创建唯一索引
CREATE UNIQUE INDEX user_deduction_log_ct ON user_deduction_log(create_time);
删除唯一索引
alter table user_deduction_log drop index user_deduction_log_ct ;

linux下修改mysql设置允许远程连接,mysql 5.7
1.新建一个用户
mysql> USE MYSQL;
mysql> GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ WITH GRANT OPTION //赋予任何主机访问以及修改所有数据的权限
2.配置为bind-address=0.0.0.0,并且这行应该加在/etc/mysql/mysql.conf.d/mysqld.cnf 配置文件里.
3.重启mysql,sudo service mysql restart
4.查看mysql运行状态 sudo service mysql status

你可能感兴趣的:(mysql)