search
HomeDatabaseMysql TutorialTeach you an example of how to quickly install mysql

linuxDownloadmysqlUnzipInstallationProcess (centos redhat has been used for N rounds in the production environment)
1.Upload mysql-5.5.29-linux2.6-x86_64.tar.gz file to the opt directory
2. Enter the opt directory to decompress the file#tar ​​-zxvf mysql-5.5.29-linux2.6-x86_64.tar.gz
3. Create mysql user group #groupadd mysql
4. Create a mysql user and join the mysql user group #useradd mysql -g mysql -p 1234567890 -s /sbin/nologin -M
5. Create a soft link #ln -s mysql-5.5.29-linux2.6-x86_64 mysql
6. (Explanation, the following /opt/mysql/ path must be consistent, if it is /opt/mysql, then keep this consistent)

#cd mysql
#chown -R mysql .
#chgrp -R mysql .
#scripts/mysql_install_db --user=mysql --datadir=/opt/mysql/data/
#chown -R root .
#chown -R mysql data
#cp support-files/my-medium.cnf /etc/my.cnf  (128M内存)
或者cp support-files/my-large.cnf /etc/my.cnf(512M内存)
或者cp support-files/my-huge.cnf /etc/my.cnf (1-2G内存)
或者cp support-files/my-innodb-heavy-4G.cnf /etc/my.cnf(4G内存)

Modify the port and other configurations in the my.cnf file
#vi /etc/my.cnf
(1). Change the 3306 port in two places to 13316
( 2), Maximum number of connections and innodb_file_per_table settings. Turn on
At the end of
# The MySQL server
[mysqld]
, add

max_connections=3100
innodb_file_per_table=1

#bin/mysqld_safe --user=mysql & Wait a few minutes before executing (press Enter)
Copy file#cp support-files/mysql.server /etc/init.d/mysql

Then modify /etc/ init.d/mysql file

basedir=/opt/mysql
datadir=/opt/mysql/data

Look down, these are changed to this (associated with the mysql path of the decompression installation):

basedir=/opt/mysql
bindir=/opt/mysql/bin
datadir=/opt/mysql/data
sbindir=/opt/mysql/bin
libexecdir=/opt/mysql/bin

Automatic startup# chkconfig --add mysql
#chkconfig mysql on
Stop#service mysql stop If the Punrecognized service error is reported: chmod 755 /etc/rc.d/init.d/mysql
Start#service mysql start
#cd ../
Initialize the password of the administrator root#/opt/mysql/bin/mysqladmin -u root password '1234567890'
Enable the root account to be used for local and remote connections#/opt/mysql/ bin/mysql -u root -p
Enter the initial good password 1234567890

mysql>GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "1234567890";
mysql>flush privileges;

Create other accounts

mysql>GRANT ALL PRIVILEGES ON *.* TO abcd@"%" IDENTIFIED BY "abcd#123456";
mysql>flush privileges;
mysql>quit;

View mysql process
#ps -ef |grep mysql

Come on, give yourself a like, it’s completed, please keep working hard.

【Related recommendations】

1. Free mysql online video tutorial

2. MySQL latest manual tutorial

3. Chuanzhi Podcast Liu Daocheng MySql series video tutorials

The above is the detailed content of Teach you an example of how to quickly install mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What are the differences in syntax between MySQL and other SQL dialects?What are the differences in syntax between MySQL and other SQL dialects?Apr 27, 2025 am 12:26 AM

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

What is MySQL partitioning?What is MySQL partitioning?Apr 27, 2025 am 12:23 AM

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 do you grant and revoke privileges in MySQL?How do you grant and revoke privileges in MySQL?Apr 27, 2025 am 12:21 AM

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.

Explain the differences between InnoDB and MyISAM storage engines.Explain the differences between InnoDB and MyISAM storage engines.Apr 27, 2025 am 12:20 AM

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.

What are the different types of JOINs in MySQL?What are the different types of JOINs in MySQL?Apr 27, 2025 am 12:13 AM

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.

What are the different storage engines available in MySQL?What are the different storage engines available in MySQL?Apr 26, 2025 am 12:27 AM

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

What are some common security vulnerabilities in MySQL?What are some common security vulnerabilities in MySQL?Apr 26, 2025 am 12:27 AM

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.

How can you identify slow queries in MySQL?How can you identify slow queries in MySQL?Apr 26, 2025 am 12:15 AM

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*.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool