Ubuntu create database and tables in mysql

1.Check status

sudo systemctl mysql status;

2.If not started mysql service

sudo  service mysql start;
sudo  service mysql status;

 

 3.Then log in mysql via below command

sudo mysql -u root -p

And enter password.

 

 

4.

create database if not exists myDB;

5.

create table if not exist mt(BookIndex int not null,BookId bigint not null,BookName varchar(100) not null,BookTitle varchar(100) not null,primary key(BookIndex));

6

 

posted @ 2022-05-14 02:13  FredGrit  阅读(25)  评论(0编辑  收藏  举报