前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >mysql 管理指令

mysql 管理指令

作者头像
用户5760343
发布2019-11-12 16:22:29
1.1K0
发布2019-11-12 16:22:29
举报
文章被收录于专栏:sktj

1、sed -n "22,25p" /etc/init.d/mysqld 2、三种关闭mysql的方式 service mysqld stop kill pidxx mysqladmin xx shutdown 3、更换配置文件启动 mysqld_safe --defaults-file=/data/xx/my.cnf 2>&1 >/dev/null & 4、mysql几个常用软件 mysql, mysqladmin , mysqldump , mysqlbinlog 5、连接方式 mysql -h -u -p -P mysql -u -p -S /xx/x.sock 6、删除历史命令 history -d 211 history -c 清除 7、配置文件设置权限 600 8、退出 : quit/exit 9、msyql初始化安全设置 delete from mysql.user; grant all privileges on . to myroot@'localhost' identified by 'pass' with grant option; flush privileges; 10、修改密码 mysqladmin -uroot -p password xxx set password for root@localhost=password('xxx') update user set password=password('123') where user='root' and host='localhost'; alter user 'root'@'localhost' IDENTIFIED BY 'liuhehe';

忘记密码:mysqld --skip-grant-tables

11、DQL,DML,DDL select * from x order by x delete from mysql.user where x='' create database dd1; show databases; show create database dd1\G; create database dd2 default character set gbk collate gbk_chinese_i;

配置文件加字符集

-DDEFAULT_CHARSET= utf8 -DDEFAULT_COLLATION=utf8_general_ci select database(); use dd1; show tables; show tables from dd1; drop database xx; 12、 select user,host from mysql.user; create user x@x identified by 'x'; show grants for bbx@xx; drop user x@x; grant all privileges on x.* to x@x identified by x;

回收权限

revoke select on . from x@x; 13、DDL create table x( a int(4) not null, name char(3) not null, dep varchar(11) default NULL ); desc x; auto_increment rename x to y; alter table x rename to y; alter table x add b int(2) not null; alter table x drop qq; alter table x modify x ; alter table test add index x(name); create index indexqq on test(qq) 14、 insert into test(id,name) values(1,"dd"); delete from test; select * from test limit 1,3; selelect * from x id>2 and id <5; order by id asc/desc; update x set x=y, where x; source xx.sql; truncate table x; drop table if exists test;

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 忘记密码:mysqld --skip-grant-tables
  • 配置文件加字符集
  • 回收权限
相关产品与服务
云数据库 SQL Server
腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档