Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation and basic operation of MySQL

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

MySQL is a real multi-threaded, multi-user SQL database service. With its high performance, high reliability and easy to use, it has become the most popular open source database system in the server field. At present, Oracle is responsible for development and maintenance.

Compilation and installation of MySQL

In order to ensure the integrity and customization of MySQL database functions, it is generally installed by compiling source code. Here we choose mysql-5.5.38.tar.gz as an example.

1. Preparatory work

(1) install the ncurses-devel package that comes with the system CD first.

(2) in order to avoid port conflicts, it is recommended to check the installation of MySQL software first, and if it is installed by RPM, uninstall it.

(3) MySQL5.5 needs to be compiled and installed using cmake, and the cmakepackage needs to be installed first.

two。 Source code compilation and installation

(1) create a MySQL running user who does not need to log in directly to the system and does not need to establish a host directory

(2) unpacking

(3) configuration

(4) compilation and installation

In the configuration command in the figure above, the meanings of the options are as follows:

-DCMAKE_INSTALL_PREFIX: specify the installation path for mysql

-DSYSCONFDIR: specify the initialization parameter file directory

-DDEFAULT_CHARSET: specifies the default character coding set, such as utf8

-DDEFAULT_COLLATION: specifies the default character set proofreading rules

-DWITH_EXTRA_CHARSETS: specifies additional supported character set encodings

3. Other adjustments after installation

(1) set permissions on the database directory

(2) establish a configuration file

(3) initialize the database

(4) set environment variables

4. Add system services and start services

MySQL servers provide services through TCP3306 ports by default

Access to MySQL database

MySQL database system is a typical application of MySQL S architecture, and special client software is needed to access it. In Linux, the simplest and easy-to-use MySQL client software is its own mysql command tool.

1. Log in to MySQL server

The default administrator user name for MySQL database is "root" and the password is empty.

two。 Execute the MySQL action statement and exit

Each MySQL operation statement ends with a semicolon, and the operation statement is not case-sensitive.

For example, execute the "show master logs;" statement to view the log file information of the current database service

Using the MySQL database

1. View database structure

Mysql > show databases; / / View which libraries are in the server mysql > use mysql; / / switch to the specified database mysql > show tables; / / View all tables in the specified database mysql > describe mysql.user; / / View the information of the fields in the table

two。 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 in the yang library mysql > drop database yang; / / delete the specified library

Manage data records in tables

Earlier, I have written the statement of SQL Server database, and the statement of MySQL database is the same as that of SQL Server, so I won't write much here.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report