1.进入mysql操作
1.mysql -u root -p
2.create database douyin_db
3.use douyin_db
4.source /home/admin/my-git/douyin_db_04.28.sql
/home/admin/data/apache-tomcat-7/conf
cat /proc/meminfo | grep Mem
2、可以查看指定端口被哪个进程占用的情况
netstat -tunlp|grep 端口号
shutdown -r now --重启
3.删除数据库
DROP DATABASE douyin_db;
create database douyin_db;
use douyin_db;
unzip /home/admin/my-git/DouYinSSH.zip -d .
delete from registration_code_info where id=7
4.删除
delete from registration_code_info where (isHaveUsed is not null and channel='a4'); //不为空;
select registerId from registration_code_info where (isHaveUsed is null) limit 0,100;
select registerId from registration_code_info where (isHaveUsed is null and channel='a1');
磁盘还剩多少空间,用df的命 df -h
5.创建新用户:
select Host,User from mysql.user;
创建一个远程用户
create user test identified by 'testtest';
GRANT select ON douyin_db.purchase_statistical_info TO 'test'@'%' identified by 'testtest' with grant option;
flush privileges;
修改
vim /etc/mysql/mysql.conf.d/mysqld.cnf
在打开文件后,在文件中找到:bind-address = 127.0.0.1这一行,然后注释掉这一行。
/mysql.conf.d# cat mysqld.cnf | grep "bind"
service mysql restart
6.维护修改表
(1) desc id_name;
(2) alter table device_info add generateTime varchar(40) DEFAULT NULL COMMENT '生成时间';
alter table registration_code_info add useState int(11) DEFAULT '1' COMMENT '注册码使用状态,0表示无效,1表示有效';
7.备份
mysqldump -uroot -p douyin_db > /home/admin/my-git/back_05.14-22.sql;