Detailed explanation of how to install MySQL5.7.18 under centos system
1. First install the dependency package
yum install -y gcc gcc-c++ ncurses-devel perl openssl-devel
The most important thing is, don’t forget to install openssl-devel
(free learning video tutorial recommended : mysql video tutorial)
2. Install cmake
tar -xzvf cmake-3.8.1.tar.gz cd cmake-3.8.1 ./bootstrap make && make install
3. Install MySQL5.7.18
First download the installation package. My installation version is :mysql-boost-5.7.18.tar.gz
You need to download boost. I am matching the boost_1_59_0 version
Download, decompress it in the /usr/local directory, and rename it to boost
First add the system account corresponding to MySQL to ensure its local file permission allocation:
groupadd mysql useradd -r -g mysql mysql
Create the database directory:
mkdir -p /var/mysql/data chown mysql:mysql /var/mysql/data
Enter the decompressed MySQL installation package:
cd mysql-boost-5.7.18 cmake . \ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \ -DINSTALL_DATADIR=/usr/local/mysql/data/master \ -DSYSCONFDIR=/usr/local/mysql/etc \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DEXTRA_CHARSETS=all \ -DWITH_SSL=system \ -DWITH_EMBEDDED_SERVER=1 \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DWITH_FEDERATED_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \ -DMYSQL_USER=mysql \ -DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock \ -DDOWNLOAD_BOOST=1 \ -DWITH_BOOST=/usr/local/boost
If an error occurs, after modification, you need to delete the CMakeCache.txt file in the current directory, and then restart cmake
make && make install
After completing the above steps, you need to change the owner of the mysql installation directory. For example, the directory we installed is /usr/local/mysql. Use the command
chown -R mysql:mysql /usr/local/mysql
to modify the directory owner. At this time, copy a copy of the default configuration file
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
After the blogger has completed the installation, there is no my-default.cnf file. You need to create it yourself. Attach the content of the file:
#For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the # *** default location during install, and will be replaced if you # *** upgrade to a newer version of MySQL. [mysqld] #aracter_set_server=utf8 #init_connect='SET NAMES utf8' sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES # 一般配置选项 basedir = /usr/local/mysql datadir = /usr/local/mysql/data/master port = 3306 socket = /usr/local/mysql/data/mysql.sock character-set-server=utf8 back_log = 300 max_connections = 3000 max_connect_errors = 50 table_open_cache = 4096 max_allowed_packet = 32M #binlog_cache_size = 4M max_heap_table_size = 128M read_rnd_buffer_size = 16M sort_buffer_size = 16M join_buffer_size = 16M thread_cache_size = 16 query_cache_size = 128M query_cache_limit = 4M ft_min_word_len = 8 thread_stack = 512K transaction_isolation = REPEATABLE-READ tmp_table_size = 128M #log-bin=mysql-bin long_query_time = 6 server_id=1 innodb_buffer_pool_size = 1G innodb_thread_concurrency = 16 innodb_log_buffer_size = 16M innodb_log_file_size = 512M innodb_log_files_in_group = 3 innodb_max_dirty_pages_pct = 90 innodb_lock_wait_timeout = 120 innodb_file_per_table = on [mysqldump] quick max_allowed_packet = 32M [mysql] no-auto-rehash default-character-set=utf8 safe-updates [myisamchk] key_buffer = 16M sort_buffer_size = 16M read_buffer = 8M write_buffer = 8M [mysqlhotcopy] interactive-timeout [mysqld_safe] open-files-limit = 8192 [client] port=3306 socket=/usr/local/mysql/data/mysql.sock #default-character-set=utf8
If the prompt already exists If the file is overwritten, just overwrite it.
Then perform the initialization operation of the database.
/usr/local/mysql/bin/mysqld --initialize --user=mysql,
At this time, the database will be initialized and a database root account will be created. However, please note that this account has a default password. During initialization, the screen will Output the initialized password. If you missed it, you can see the default password by looking at /root/.mysql_secret.
Execute cp /usr/local/mysql/support-files/mysql.server /etc/init.d, copy the mysql service startup script, and then execute service mysql.server start to start mysql.
Finally /usr/local/mysql/bin/mysql -rroot -p, enter the password and press Enter. If Access denied for user 'root'@'localhost' (using password: YES) appears, under normal circumstances
service mysql.server restart Restart
After passing, you can use the following command to reset the root password
set password=password('你的密码');
At this point, the basic installation process is completed
The following method can be used to set up the startup
Commandecho "service mysqld start" >> /etc/rc.local
Or enter the /etc/ directory, Directly edit the rc.local file with vim rc.local, add "service mysqld start" in the last line, save and exit.
The above is the detailed content of Detailed explanation of how to install MySQL5.7.18 under centos system. For more information, please follow other related articles on the PHP Chinese website!

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA


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

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools