Firstly, you need to remove the current MySQL if you are already using:
$ sudo apt-get purge mysql-client-core-5.5
Now, to install MySQL, by running the following commands in terminal:
$ sudo apt-get install mysql-server
$ sudo apt-get install mysql-client
During the installation you will be asked to enter a password for the MySQL root user.
Use any password you like and remember it.
For Mysql-Workbench(optional):
sudo apt-get install mysql-workbench
First you have to remove mysql completely from your system using following commands in terminal
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get update && sudo apt-get upgrade
sudo apt-get autoremove
sudo apt-get autoclean
Now try to reinstall Mysql.
To open mysql command line:
sudo mysql -u root -p password
View all existing databases:
show databases;
If you want to use an existing database:
use DATABASE_NAME;
Or, create a database by following command:
create database db_name
If you wish to view all tables use command:
show tables;
If you want to IMPORT an existing database with .sql file, use the following command:
Note: Before imposting you need to use a database into which you need to import your dump.
mysql> \. home/db_dump.sql;
0 Comment(s)