MySQL Basic Queries Flashcards
What is the first line of code upon opening command prompt?
cd\ [enter]
What is the next command you will type after changing directory (cd)?
cd xampp\mysql\bin [enter]
After going to mysql bin, what comes after?
mysql –h localhost –p –u root [enter]
If you wish to cancel a command, you may type __?
\C
To display the mySQL or MariaDB version installed in your computer
select version(), current_date;
To know the current date and time
select now();
To know the user currently logged into the system
select user();
To show the listing of the databases on the server
show databases;
To select a database to use
use [database_name];
To show the name of the currently selected database
select database();
To show the tables on the currently selected
database
show tables;
To show the structure of a particular table
describe [table_name];
To view the users on the server
select user, host, password from mysql.user;
To set user password
alter user [user_name] identified by [new_password];
To create a new user account
create user [user_name] identified by [password];