A, Linux installed MySQL
1, MySQL official website
• download the main page
https://www.mysql.com/downloads/
• Community Resources download page
https://dev.mysql.com/downloads/
• MySQL Community Edition download page
https://dev.mysql.com/downloads/mysql/
2, MySQL community software-related Products
• MySQL Community Server
The most popular open source database management software, the first current version is 8.0.
• MySQL Cluster
MySQL-based database and implement cluster service itself can provide high concurrent high load characteristics and so on.
• MySQL Fabric
For solutions for highly available MySQL database and data fragmentation MySQL official provided.
• MySQL Connectors
Provides JDBC / ODBC applications to access the interface as the service MySQL database.
3, MySQL Community Server versions major differences.
• MySQL4.0 version: Added support to a query, the character set to increase UTF-8, CROUP BY statement adds ROLLUP, mysql.user table uses a better encryption algorithm, lnnodb began to support a separate table space.
• MySQL5.0 version: added support for stored procedures, views, cursors, triggers, XA transactions, an increase of INFORATION_SCHEMA system database.
• MySQL5.5 version: Change lnnoDB, improve performance and scalability, semi-synchronous replication to increase the default storage engine.
• MySQL5.6 Version: lnnoDB improve performance, support for delay replication.
• MySQL5.7 Version: enhance database performance and storage engine, more robust replication capabilities, increasing the inventory sys put the database management system information.
• MySQL8.0 version:
4, MySQL installation ----- preparation (1)
• Check the operating system and the MySQL version of the adapter.
• Check the operating system and the MySQL version of the adapter
5, MySQL installation ----- preparation (2)
• Select the MySQL version installed
• First, determine whether you want to and other companies have installed MySQL consistent version.
• If there is no such requirement is generally install the latest version.
• If not experiment with new functional properties, do not select developmentrelease, and to install the General Availability (GA) release (on behalf of the stable version can be used in production systems)
• Select how to install MySQL.
• Binary installation packages (RPM, zip, tar, etc.)
• Source mode (source code)
• generally choose a binary installation.
• If you have special needs, such as modifying a part of the source code or modify MySQL deep configuration, it will select the source mode.
6, the binary tar packages installed MySQL Linux installation.
• 1. Download the correct tar package • 2. Upload the tar package to the server and extract the tar package to the next / usr / local / directory. [zhang01 the root @ ~] # CD / usr / local / [the root @ zhang01 local] # pwd / usr / local [@ zhang01 the root local] # -xvfmysql the tar-8.0.17-Linux-glibc2.12-x86_64.tar. the xz [root @ zhang01 local] # mv MySQL-8.0.17-Linux-x86_64-glibc2.12 MySQL • 3. create a running MySQL user and group (name can be arbitrary) [root @ zhang01 local] # useradd MySQL [root @ local zhang01] ID # MySQL UID = 1000 (MySQL) GID = 1000 (MySQL) group 1000 = (MySQL) • Catalog MySQL 4. switch to the root @ zhang01 local] MySQL # CD / [@ zhang01 the root MySQL] # pwd / usr / local / MySQL # create a data directory [root @ zhang01 MySQL] # mkdir data # modify user data directory permissions [root @ zhang01 mysql] # chown -R mysql.mysql data • 5. Installation + MySQL initialization starts ----- # initialize the data directory [@ zhang01 the root MySQL] # bin / mysqld - MySQL --datadir the initialize --user = / usr / local / MySQL / Data # a startup method: Start command MySQL service [@ zhang01 the root MySQL] # bin / the mysqld_safe --datadir = / usr / local / MySQL / MySQL Data --user = # start method 2: MySQL was added to the service [root @ zhang01 mysql] # cp support-files /mysql.server/etc/init.d/mysql.server [root @ zhang01 mysql] # /etc/init.d/mysql.server Start • 6. install MySQL ----- added variables [root @ zhang01 mysql] vim ~ # / .bash_profile the PATH = $ the PATH: $ the HOME / bin: / usr / local / MySQL / bin Source ~ / .bash_profile # direct access to the database using the MySQL command [root @ zhang01 mysql] # mysql -u root -p
7, MySQL error and is not recommended for use initialization
# Startup process if encountered following error [MySQL the root @ localhost] # bin / mysqld MySQL --initialize --user = - DATADIR / usr / local / MySQL / Data bin / mysqld: errorwhile loading Shared Libraries:, libaio.so .1: CAN not Open Shared Object File: No SUCH File ordirectory # you need to install the package yum install -y libaio
# Do not use the recommended installation path method
[root@localhostmysql]# bin/mysqld --initialize --user=mysql -basedir=/data/mysql --datadir=/data/mysql/data [root@localhostmysql]# bin/mysqld_safe--basedir=/data/mysql-datadir=/data/mysql/data --user=mysql &
# If you use /etc/init.d/mysql.server will fail to start
[root@localhost bin]# /etc/init.d/mysql.server start /etc/init.d/mysql.server: line 239: my_print_defaults: command not found /etc/init.d/mysql.server: line 259: cd: /usr/local/mysql: No such file or directory Starting MySQL ERROR! Couldn't find MySQL server (/usr/local/mysql/bin/mysqld_safe)
# MySQL non-default installation path
[root@localhost ~]# cat /etc/my.cnf [mysqld] basedir=/data/mysql datadir=/data/mysql/data # 在启动 [root@localhost ~]# /etc/init.d/mysql.server start Starting MySQL SUCCESS!
8, into the MySQL database
• initialization process to obtain the initial root password
Check out the MySQL process by ps -ef • After startup is complete
• Log on MySQL database
• modify the initial password for root
# 8.0 does not support this command
mysql> set password=password('mysql'); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'password('mysql')' at line 1 # 修改root初始密码为123456 mysql> alter user root@localhost identified by '123456'; Query OK, 0 rows affected (0.01 sec)
Modify the configuration file
Data file # mobile data path. # Create a directory data store. [@ zhang01 the root] # mkdir -p / Data / MySQL / # switching of the directory. [@ zhang01 the root mysql] # CD / Data / mysql / # mysql the directory data is moved to this directory. [root @ zhang01 MySQL] # mv / usr / local / MySQL / the Data ./ # edit the configuration file. Modify the data path. [@ zhang01 the root MySQL] CAT # /etc/my.cnf [mysqld] DATADIR = / Data / MySQL / Data