0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Mac】MySQLの基本操作

Last updated at Posted at 2020-04-29

■パッケージインストール
npm init --yes
npm install express ejs
npm install nodemon("start": "./node_modules/.bin/nodemon app.js")
npm install mysql


jsファイルの編集

■サーバー起動
node app.js

■MySQLの繋げ方

brew services start mysql@5.7
mysql --user=root --password

■MySQLの接続解除
exit;

■データベース
SHOW databases;
CREATE DATABASE データベース名;

■テーブル
・データベースの選択
USE データベース名;

・テーブル一覧の確認
SHOW tables;

・テーブルの作成
CREATE TABLE テーブル名 (id int auto_increment, name text, primary key (id));

・テーブル構造の表示
DESCRIBE テーブル名;

・テーブル削除
DROP TABLE テーブル名;
DROP DATABASE テーブル名;

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?