MYSQL 经常使用tips

MYSQL 经常使用tips

  • 启动:brew services start mysql
  • terminal登录:路径 -u 用户名 -p
  • mysql -u root -p
  • 更改初始密码:set password for ‘root’@’localhost’ = password(‘newPassword’);

db 操作

* show databases;
* create NEW_DB;
* drop NEW_DB;
* use DBname;

table 操作

* CREATE TABLE table_name (column_name column_type);
* DROP TABLE table_name ;
* INSERT INTO table_name ( field1, field2,...fieldN )
                       VALUES
                       ( value1, value2,...valueN );
* SELECT column_name,column_name
FROM table_name
[WHERE Clause]
[OFFSET M ][LIMIT N]
* DELETE FROM table_name [WHERE Clause]

发表评论

电子邮件地址不会被公开。 必填项已用*标注