mysql command

using mysql from console
$mysql -u myuser -pmypassword

show database
mysql>show databases;

connect to database
mysql>use mydatabase;

show tables inside the database
mysql>show tables;

show what inside the table
mysql>select*from tablenamesatu

search the data inside the table
mysql>select*from tablenamesatu where columndata=’data’;
mysql>select*from tablenamesatu where columndata mycolumns like ‘data%’;

insert data
mysql>insert into tablenamesatu (column1,column2,..) values(‘data’,’data’,’…’);

delete data
mysql>delete from tablenamesatu where username=’data’;

update/change data
mysql>update tablenamesatu set columndata=’data’ where columndata1=’data’;

show header of column of table
mysql>show columns from tablenamesatu;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.