Install and configure MySQL in Ubuntu

Source: Internet
Author: User

Install and configure MySQL in Ubuntu
Install MySQL in Ubuntu

Command: sudo apt-get install mysql-server

MySQL initial configuration and management
  • Start MySQL

    Mysql start: mysqld is the mysql daemon

  • Check whether mysql is started:

    ps -ef | grep mysqld

Common commands in MySQL
  • Connection SQL: mysql-h host name-u user name-p User Password
  • Show databases/tables;
  • Create: create database/tables;
  • Delete: drop database name; delete from tablesName where condition;
  • Connect to the database: use databaseName;
  • Query: select * from databaseName;
  • Insert: insert into tableName values ();
  • Add field: alter table name add field type others;
  • Update: update tableName set field = new value where condition;
  • Modify table Name: rename table original table name to new table name
How to view error logs
  • System Error:/var/log/syslog
  • Mysql log:/var/log/mysql
Errors and Solutions

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Solution:

mysql server startps -ef | grep mysqlkill [the id]sudo /etc/init.d/mysql restart

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.