MishaVacic
MishaVacic

Reputation: 1887

How to use MySQL in terminal?

I am new to mySQL,on my Ubuntu 16.04. I am learning from J.Murach's book.So the problem is when I have to create large table

CREATE TABLE invoices
(
invoice_id INT PRIMERY_KEY  AUTO INCREMENT,
vendor_id  INT NOT NULL,
invoice_number VARCHAR(50) NOT NULL,

...

How to type this in terminal?I do not know anything about spaces and tabs?Should I use some text editor?

Upvotes: 1

Views: 2969

Answers (2)

Elson D'souza
Elson D'souza

Reputation: 95

Run the following commands to install MySql server on Ubuntu

sudo apt update
sudo apt install mysql-server mysql-client

Once the setup completes you should be able to use MySql by just typing the command in the Terminal

mysql -u root -p

and then the password on being prompted. You can directly enter the sql statements in the terminal then.

To exit, type

exit

Upvotes: 4

Anand Kumar
Anand Kumar

Reputation: 13

If you're using XAMPP Control Panel, locate your MySQL folder in your home drive(in Windows it's C:\xampp\mysql\bin).Once you get to the bin folder, run the MySQL.exe file (again in windows: MySQL.exe -uroot -p).Replace root with the name of your administrator account. DONT change anything else. Then u should open in to the MySQL command screen. Note that in later versions of xampp, its called MariaDB and I have no idea why :-). Happy Coding, Anand

Upvotes: 0

Related Questions