Getting started with MySQL

Source: Internet
Author: User
Tags mysql commands mysql login

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.