温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

mysql有哪些常用的基本语句

发布时间:2020-05-29 17:23:03 来源:网络 阅读:183 作者:三月 栏目:数据库

下文我给大家简单讲讲关于mysql有哪些常用的基本语句,大家之前了解过相关类似主题内容吗?感兴趣的话就一起来看看这篇文章吧,相信看完mysql有哪些常用的基本语句对大家多少有点帮助吧。

create user shenge1@'192.168.200.%' identified by 'linwei'//创建一个用户
grant all privileges on *.* to shenge1@'192.168.200.%' identified by 'linwei'//给此用户赋权限.

flush privileges;

grant 权限 on 数据库对象.表 to 用户@ip identified by 密码

权限:REPLICATION SLACE,REPLICATION CLIENT

数据库对象:*.*(*.*说明数据库.表名)

用户:shenge1 那个%号是通配符,表示用户relp能在192.168.200.1~192.168.200.254所在的服务登录密码:linwei

mysql -ub -hwww.a.com -pb;可以直接登陆,用户名为b,密码为b,www.a.com为mysql云服务器地址


mysql -u shenge1 -h 192.168.200.157 --password=linwei  登陆或者-p手动输入密码

mysql < 01.sql  =>在01.sql中写好mysql语句,可以这样执行.

mysql -u shenge1 -h 192.168.200.157 --password=linwei < 01.sql

delete from mysql.user where User='shenge1'; 删除某个用户

show databases;显示所有数据库

show tables from mysql; 显示mysql数据库中的所有表名

create database student;建一个student数据库

drop database student;删除student数据库

create table test.student(name char,math int);在数据库test中创建student表格

drop table test.student;删除test数据库中的student表格

show columns from 表名或者describe 表名 查看表的结构

insert into test.student(name,math)values('xiaoming',87);插入数据

alter table test.student drop name;删除name这个字段.

alter table test.student add name  char(20);增加name这个字段

update test.student set name="xiaoming" where math=78;更新某个数据的值

大家觉得mysql有哪些常用的基本语句这篇文章怎么样,是否有所收获。如果想要了解更多相关,可以继续关注我们的行业资讯板块。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI