Mac mysql shell

来源:互联网 发布:php集成开发环境 编辑:程序博客网 时间:2024/05/24 07:12

xampp mysql路径

cd /applications/xampp/bin


系统  mysql路径

cd /usr/local/mysql/bin


连接数据库

./mysql -u root -p

显示端口号

show global variables like 'port';

修改密码

mysql> set password for root@localhost = password('123'); 

退出

exit


表 字段

create table 表名(
id int(3),
name varchar(8),
password varchar(20)
);

alter table 哪个个表增 add email varchar(25) not null;

insert into tbl_user values (1,'shawuer','123456');(插入数据)

drop table 表名;

alter table 哪个表 drop 的哪个字段;

rename table 原表名  to 新表名;

alter table 哪个表的字段 change 原字段名 新字段名 int(3);

show tables from shawuerdb; (显示shawuerdb数据库的所有表)
describe tbl_user;(显示tbl_user表的所有字段)

select *from tbl_user; (查看tbl_user表内容)

原创粉丝点击