MySQL Installation:
sudo apt-get install Mysql-server
sudo apt-get install mysql-client
use Brew installation in your MAC:
Brew Install mysql;//installing Brew Services start mysql;//start service
JDBC Installation:
sudo apt-get install Libmysql-java
C Language link library installation:
sudo apt-get install Libmysqlclient-dev
the MySQL service opens:
To see if the MySQL service is running the command: sudo netstat-tap | grep MySQL
1, if the MySQL service is running will prompt: TCP 0 0 localhost:mysql *:* LISTEN 12114/mysqld
2, if the MySQL service does not start, there is nothing to prompt
Direct input of MySQL commands will prompt errors, such as: Mysql-u halu126-p
will prompt for error:
ERROR 2002 (HY000): Can ' t connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock ' (2)
Input Mysql-uroot Enter
Mysqladmin-u root-p password xxxx
Change Password
If the MySQL service does not start, you can start with the command: Sudo/etc/init.d/mysql start,
Command: Sudo/etc/init.d/mysql Restart is used to restart the MySQL service
Command: Sudo/etc/init.d/mysql stop is used to stop the MySQL service
MySQL Status View:
Show status;//View database status show variables;//view database parameters such as: Show variables like "%version%";
MySQL Management:
Command: All commands have three standard parameters:-u username-p [Password]-H host
1. mysql login 2, mysqladmin Create dbname: Creates a new database named DBName drop dbname: Delete dbname database flush-tables: Clean all tables Passwor D NewPassword: Change the old password with NewPassword shutdown: Turn off the MySQL server status: Give the server a brief state message variables: Print all available variables version: gives the server's release information 3. mysqldump mysqldump [options] dbname [tables] option: slightly. 4, Mysqlimport accompany with mysqldump together, the parameter is the database name, and the text to recover the file name 5, mysqlshow mysqlshow [dbname [TableName [Columunname]]] using mysql-u- P Login: You can use the appropriate SQL statements, such as: Grant, REVOKE, delete, update, select, and so on.
CREATE DATABASE dbname
show databases see which databases are logged in to the user!
use dbname using dbname database
Show tables to view tables in the current database
Getting started with MySQL