- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Creating and Selecting a MySQL Database
Creating a Database
A database can be created using the below statement −
CREATE DATABASE databaseName;
Example
CREATE DATABASE STUDENT
Selecting a MySQL Database
If we wish to access and use a specific database, we can use the following query −
Query
mysql> USE databaseName Database changed
Example
USE STUDENT
The ‘USE’ statement doesn’t require a semi-colon. This is similar to the ‘QUIT’ statement. Even if semi-colon is used, it does no harm.
We can create and use a database of our own, but before that, MySQL administrator’s permission is required.
The MySQL administrator can execute a command as shown below to provide permissions −
mysql> GRANT ALL ON tableName.* TO ‘your_mysql_name’@’your_client_host’;
Here, ‘your_mysql_name’ refers to the MySQL user name which is assigned to the user.
The ‘your_client_host’ refers to the host from which the user connected to the server.
Advertisements