mysql installation and initialization
MySQL overview MySQL background
MySQL was formerly owned by MySQL AB, which was acquired by SUN in 2008 and then by Oracle in 2009
The benefits of the database Persist
data to the local
Provide structured query function
Advantages of MySQL:
low cost, open source and free
High performance and good portability
Small size, easy to install
Common concepts of
database DB: database, warehouse for storing data
DBMS: database management system, also known as database software or database product, used to create and manage databases, common MySQL, Oracle, SQL Server
DBS: database system, database system It is a general term, including databases, database management systems, database administrators, etc. It is the largest category
SQL: structured query language, the language used to communicate with the database, not specific to a certain database software, but almost all mainstream databases Software common language
Classification of SQL language
DQL: data query language: select, from, where
DML: data manipulation language: insert, update, delete
DDL: data definition language: create, alter, drop, truncate
DCL: data control language: grant, revoke
TCL: Transaction control language: commit, rollback
2.mysql installation
official website installation path https://downloads.mysql.com/archives/community/
Installation dependency
Compile make
jn n (number of cpu cores)
Compilation speed is fast, but error-prone
3.mysql initialization
Add user -M does not create a user home directory -d Add a new user home directory as -s specifies the user shell
Create directory owner all groups as mysql
The current user sets the exclusive environment information and startup program, and the file is executed once when the user logs in. By default, it is used to set environment variables and execute the current user's .bashrc file.
basedir = path Use the given directory as the root directory (installation directory).
datadir = path Read database files from the given directory.
pid-file = filename Specify a file to store the process ID for the mysqld program (only applicable to UNIX/Linux systems); the Init-V script needs to use the process ID in this file to end the mysqld process.
socket = filename specifies a socket file for the local communication between the MySQL client program and the server (only applicable to UNIX/Linux systems; the default setting is generally the /var/lib/mysql/mysql.sock file).
mysqld --initialize --user=mysql failed because /usr/local/mysql has data
Delete all files under /usr/local/mysql. Can operate normally.
To give cd /etc/init.d/mysqld execute permission
Otherwise mysql -p cannot be executed
0 Comments