Mysql deployment document
Operating system: CentOS Linux release 7.4.1708
Kernel version: 3.10.0
# Manual installation
1> Mysql-5.5.54 -linux2.6-x86_64.tar.gz Upload to the CentOS server/tmp directory
2> Unzip the compressed package to /usr/local/
[root@localhost local]# tar -zxvf /tmp/mysql-5.5.54-linux2.6-x86_64.tar.gz -C /usr/local/
3> Set up soft connection
[root@localhost local]# ln -s mysql-5.5.54-linux2.6-x86_64/ mysql
4> Add user group and user
[root@localhost local]# groupadd -r mysql [root@localhost local]# useradd -g mysql -r -s /sbin/nologin mysql
5> Give/ usr/local/mysql/*Permissions
##
[root@localhost local]# chown -R mysql.mysql /usr/local/mysql/*6> Set the data storage path and grant permissions
[root@localhost local]# mkdir –p /data/mydata [root@localhost local]# chown -R mysql.mysql /data/mydata7> Initialize mysql
[root@localhost local]# cd /usr/local/mysql [root@localhost local]# scripts/mysql_install_db --datadir=/data/mydata --user=mysql8> Change back to root permission
##
[root@localhost local]# chown -R root /usr/local/mysql/*
9> Join automatic startup
[root@localhost local]# cp -a mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld [root@localhost local]# chkconfig --add mysqld
10> Modify the configuration file
[root@localhost local]# cp -a /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf [root@localhost local]# vi /data/mydata
Add datadir = /data/mydata under the [mysqld] field thread_concurrency = 2 times the number of physical CPU cores
Save, exit /etc/my.cnf
##11> Start the mysql service
##
[root@localhost local]# /etc/rc.d/init.d/mysqld start12> Create root user password
*Log in to mysql first
[root@localhost local]# mysql -uroot -hlocalhost -p Enter password:*Continuing from above, Enter password:
(press Enter directly)
*Set password, Assume the password is: zz2014info
##
mysql> SET PASSWORD FOR 'root'@'localhost'=PASSWORD('zz2014info');
*If it is displayed as follows, it means the password is created successfully
Query OK, 0 rows affected (0.14 sec)
13> Create mysql Example
*Create a mysql instance, such as logincenter
********************************* *******************************
******************** The development side uses lowercase letters ******************************
**************** ****Ignore case configurable******************************
************ ***************************************************
mysql> CREATE DATABASE logincenter; Query OK, 1 row affected (0.01 sec)
*Check whether the instance is created successfully
mysql> SHOW DATABASES;+--------------------+ | Database | +--------------------+ | information_schema | | logincenter | | mysql | | performance_schema | | test | +--------------------+
14> Add the mysql command to the environment variable
[root@localhost local]# echo "PATH=$PATH:/usr/local/mysql/bin" > /etc/profile.d/mysql.sh[root@localhost local]# echo "export PATH" >> /etc/profile.d/mysql.sh[root@localhost local]# source /etc/profile
15> Import .sql statement script (take logincenter.sql as an example)
[root@localhost local]# mysql -uroot -pzz2014info logincenter < /tmp/logincenter.sql
The above is the detailed content of Mysql installation method in CentOS. For more information, please follow other related articles on the PHP Chinese website!

MySQLdiffersfromotherSQLdialectsinsyntaxforLIMIT,auto-increment,stringcomparison,subqueries,andperformanceanalysis.1)MySQLusesLIMIT,whileSQLServerusesTOPandOracleusesROWNUM.2)MySQL'sAUTO_INCREMENTcontrastswithPostgreSQL'sSERIALandOracle'ssequenceandt

MySQL partitioning improves performance and simplifies maintenance. 1) Divide large tables into small pieces by specific criteria (such as date ranges), 2) physically divide data into independent files, 3) MySQL can focus on related partitions when querying, 4) Query optimizer can skip unrelated partitions, 5) Choosing the right partition strategy and maintaining it regularly is key.

How to grant and revoke permissions in MySQL? 1. Use the GRANT statement to grant permissions, such as GRANTALLPRIVILEGESONdatabase_name.TO'username'@'host'; 2. Use the REVOKE statement to revoke permissions, such as REVOKEALLPRIVILEGESONdatabase_name.FROM'username'@'host' to ensure timely communication of permission changes.

InnoDB is suitable for applications that require transaction support and high concurrency, while MyISAM is suitable for applications that require more reads and less writes. 1.InnoDB supports transaction and bank-level locks, suitable for e-commerce and banking systems. 2.MyISAM provides fast read and indexing, suitable for blogging and content management systems.

There are four main JOIN types in MySQL: INNERJOIN, LEFTJOIN, RIGHTJOIN and FULLOUTERJOIN. 1.INNERJOIN returns all rows in the two tables that meet the JOIN conditions. 2.LEFTJOIN returns all rows in the left table, even if there are no matching rows in the right table. 3. RIGHTJOIN is contrary to LEFTJOIN and returns all rows in the right table. 4.FULLOUTERJOIN returns all rows in the two tables that meet or do not meet JOIN conditions.

MySQLoffersvariousstorageengines,eachsuitedfordifferentusecases:1)InnoDBisidealforapplicationsneedingACIDcomplianceandhighconcurrency,supportingtransactionsandforeignkeys.2)MyISAMisbestforread-heavyworkloads,lackingtransactionsupport.3)Memoryengineis

Common security vulnerabilities in MySQL include SQL injection, weak passwords, improper permission configuration, and unupdated software. 1. SQL injection can be prevented by using preprocessing statements. 2. Weak passwords can be avoided by forcibly using strong password strategies. 3. Improper permission configuration can be resolved through regular review and adjustment of user permissions. 4. Unupdated software can be patched by regularly checking and updating the MySQL version.

Identifying slow queries in MySQL can be achieved by enabling slow query logs and setting thresholds. 1. Enable slow query logs and set thresholds. 2. View and analyze slow query log files, and use tools such as mysqldumpslow or pt-query-digest for in-depth analysis. 3. Optimizing slow queries can be achieved through index optimization, query rewriting and avoiding the use of SELECT*.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Dreamweaver CS6
Visual web development tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Atom editor mac version download
The most popular open source editor

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
