Syntax of MySQL in MAC

 

Syntax of MySQL in MAC commands

Start MySQL

sudo /usr/local/mysql/support-files/mysql.server start
sudo /usr/local/mysql/support-files/mysql.server stop
sudo /usr/local/mysql/support-files/mysql.server restart

Open MySQL

mysql -u root -p

Reset password

./mysql
FLUSH PRIVILEGES;
SET PASSWORD FOR root@localhost = '123456';

Check database

show databases;

Change database

use + "database_name";

Describe

show tables;

describe + "database_name";

Create database

create database + "name";

Comment

-- single line
/*
multiline comment
*/

Comments

Popular posts from this blog

Foreign key