Installation and basic operation of MySQL

Source: Internet
Author: User

MySQL is a true multi-threaded, multi-user SQL database service that has become the most popular open source database system in the server domain with its high performance, reliability, and ease of use. Currently, the Oracle company is responsible for developing and maintaining


MySQL Compile and install

? ? In order to ensure the integrity of MySQL database function, customizable, the general use of source code to compile the way to install, here choose mysql-5.5.38.tar.gz as an example


1. Preparatory work

(1) First install the System CD Ncurses-devel package

(2) In order to avoid port conflicts, it is recommended to check the installation of the MySQL software, if you use the RPM method of installation, uninstall it

(3) MySQL5.5 needs to be installed with CMake, the CMake package needs to be installed first


2. Source code compilation and installation

(1) Create MySQL running user, this user does not need to log in directly to the system, can not establish the host directory

(2) Unpacking

(3) configuration

(4) Compile and install

? ? In the configuration command, each option has the following meanings:

-dcmake_install_prefix: Specify the installation path for MySQL

-dsysconfdir: Specifying initialization parameter file directory

-ddefault_charset: Specifies the default set of character encodings, such as UTF8

-ddefault_collation: Specifying the default character set collation rules

-dwith_extra_charsets: Specify additional support for other character set encodings


3. Other adjustments after installation

(1) Setting permissions on the database directory

(2) Setting up the configuration file

(3) Initializing the database

(4) Setting environment variables


4. Add the system service and start the service

? ? MySQL server default service via TCP3306 port



Accessing the MySQL Database

? ? MySQL database system is a typical application of C/s architecture, which requires specialized client software to access MySQL database. In Linux, the simplest and easiest to use MySQL client software is its own MySQL command tool

1. Log in to MySQL server

? ? MySQL database default administrator user name is "root", password is empty


2. Execute the MySQL action statement and exit

? ? Each MySQL operation statement is semicolon; end, action statement is case insensitive

Example: execute "show master logs;" Statement to view log file information for the current database service



Using the MySQL Database

1. View the database structure

mysql>?show?databases;????????? See which libraries are mysql>?use?mysql; on the server?????????????? Switch to mysql>?show?tables;???????????? in the specified database View all tables in the specified database mysql>?describe?mysql.user;??????? View information for each field in a table


2. Create and delete libraries and tables

mysql>?create?database?yang;????????????? Create a new library mysql>?create?table? Table name? (Field 1? type, field 2? type,..., Primary?key? (primary key name);???? Create a new table mysql>?drop?table?yang.user;?????????????? Delete the user table mysql>?drop?database?yang; in the Yang library???????????????? Delete the specified library




Manage data records in a table?

? ? The SQL Server database has been written in the previous statement, the MySQL database statement and SQL Server statements are the same, there is not much to write




Installation and basic operation of MySQL

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.