CentOS 6.6 下源码编译安装MySQL 5.7.5
说明:CentOS 6.6 下源码编译安装MySQL 5.7.5 1. 安装相关工具# yum -y install gcc-c++ ncurses-devel cmake make perl \ gcc a
说明:CentOS 6.6 下源码编译安装MySQL 5.7.5
1. 安装相关工具
# yum -y install gcc-c++ ncurses-devel cmake make perl \
gcc autoconf automake zlib libxml libgcrypt libtool bison
2. 清理环境
检查boost版本:
# rpm -qa boost*
卸载boost-*等库:
# yum -y remove boost-*
3. mysql源码包下载
mysql5.7源码下载:
mysql镜像站:
4. 创建mysql用户, 组及目录
# groupadd mysql
# mkdir /home/mysql
# mkdir /home/mysql/data
# useradd -g mysql -d /home/mysql
5. 注意事项
从MySQL 5.7.5开始Boost库是必需的,下载Boost库,在解压后复制到/usr/local/boost目录下,然后重新cmake并在后面的选项中加上选项 -DWITH_BOOST=/usr/local/boost
(下载:)
需求boost1.57.0
wget -c
6. 新版本的mysq用cmake编译安装
解压mysql源码包mysql-5.7.5-m15.tar.gz
# tar -xzvf mysql-5.7.5-m15.tar.gz
以下操作在解压后的源码包的根目录执行
cmake编译
# cmake -DCMAKE_INSTALL_PREFIX=/home/mysql -DMYSQL_DATADIR=/home/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_TCP_PORT=3306 -DMYSQL_USER=mysql -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 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost
常用参数:
CMAKE_INSTALL_PREFIX:指定MySQL程序的安装目录,默认/usr/local/mysql
DEFAULT_CHARSET:指定服务器默认字符集,默认latin1
DEFAULT_COLLATION:指定服务器默认的校对规则,默认latin1_general_ci
ENABLED_LOCAL_INFILE:指定是否允许本地执行LOAD DATA INFILE,默认OFF
WITH_COMMENT:指定编译备注信息
WITH_xxx_STORAGE_ENGINE:指定静态编译到mysql的存储引擎,MyISAM,MERGE,MEMBER以及CSV四种引擎默认即被编译至服务器,不需要特别指定。
WITHOUT_xxx_STORAGE_ENGINE:指定不编译的存储引擎
SYSCONFDIR:初始化参数文件目录
MYSQL_DATADIR:数据文件目录
MYSQL_TCP_PORT:服务端口号,,默认3306
MYSQL_UNIX_ADDR:socket文件路径,默认/tmp/mysql.sock
编译安装
# make && make install
出错后重新运行配置,需要删除CMakeCache.txt文件
# make clean
# rm -f CMakeCache.txt
7. 设置权限并初始化MySQL系统授权表
设置权限
# cd /home/mysql
# chown -R mysql .
# chgrp -R mysql .
以root初始化操作时要加–user=mysql参数,生成一个随机密码(注意保存登录时用)
# cd /home/mysql
# bin/mysqld --initialize --user=mysql --basedir=/home/mysql --datadir=/home/mysql/data
8. 创建配置文件
将默认生成的my.cnf备份
# mv /etc/my.cnf /etc/my.cnf.bak
进入mysql的安装目录支持文件目录
# cd /home/mysql/support-files
拷贝配置文件模板为新的mysql配置文件,
# cp my-default.cnf /etc/my.cnf
可按需修改新的配置文件选项, 不修改配置选项, mysql则按默认配置参数运行.
如下是我修改配置文件/etc/my.cnf, 用于设置编码为utf8以防乱码
[mysqld]
character_set_server=utf8
init_connect='SET NAMES utf8'
[client]
default-character-set=utf8
9. 配置mysql服务开机自动启动
拷贝启动文件到/etc/init.d/下并重命令为mysqld
# cp /home/mysql/support-files/mysql.server /etc/init.d/mysql
增加执行权限
# chmod 755 /etc/init.d/mysqld
检查自启动项列表中没有mysqld这个,如果没有就添加mysqld:
# chkconfig --list mysqld
# chkconfig --add mysqld
设置MySQL在345等级自动启动
# chkconfig --level 345 mysqld on
或用这个命令设置开机启动:
# chkconfig mysqld on
10. mysql服务的启动/重启/停止
启动mysql服务
# service mysqld start
重启mysql服务
# service mysqld restart
停止mysql服务
# service mysqld stop
11. 访问mysql数据库
连接mysql, 输入初始化生成的随机密码
# mysql -uroot -p
修改root新密码如 123456
mysql> alter user 'root'@'localhost' identified by '123456';
mysql> quit;
mysql> exit;(与上等效, 都是退出mysql连接)
使用新密码重新连接mysql
# mysql -uroot -p
以下是小编为您精心挑选的MySQL相关内容,看看是否有所帮助:
Linux下安装编译MySQL5.5.28
Linux下MySQL 5.6.23安装
CentOS 7下源码安装MySQL 5.6
MySQL5.7.3.0安装配置图解教程
Ubuntu 14.04下安装MySQL
《MySQL权威指南(原书第2版)》清晰中文扫描版 PDF
Ubuntu 14.04 LTS 安装 LNMP Nginx\PHP5 (PHP-FPM)\MySQL
Ubuntu 14.04下搭建MySQL主从服务器
Ubuntu 12.04 LTS 构建高可用分布式 MySQL 集群
Ubuntu 12.04下源代码安装MySQL5.6以及Python-MySQLdb
MySQL-5.5.38通用二进制安装
本文永久更新链接地址:

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

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

Hot Topics











Full table scanning may be faster in MySQL than using indexes. Specific cases include: 1) the data volume is small; 2) when the query returns a large amount of data; 3) when the index column is not highly selective; 4) when the complex query. By analyzing query plans, optimizing indexes, avoiding over-index and regularly maintaining tables, you can make the best choices in practical applications.

Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

MySQL and MariaDB can coexist, but need to be configured with caution. The key is to allocate different port numbers and data directories to each database, and adjust parameters such as memory allocation and cache size. Connection pooling, application configuration, and version differences also need to be considered and need to be carefully tested and planned to avoid pitfalls. Running two databases simultaneously can cause performance problems in situations where resources are limited.

In MySQL database, the relationship between the user and the database is defined by permissions and tables. The user has a username and password to access the database. Permissions are granted through the GRANT command, while the table is created by the CREATE TABLE command. To establish a relationship between a user and a database, you need to create a database, create a user, and then grant permissions.

Data Integration Simplification: AmazonRDSMySQL and Redshift's zero ETL integration Efficient data integration is at the heart of a data-driven organization. Traditional ETL (extract, convert, load) processes are complex and time-consuming, especially when integrating databases (such as AmazonRDSMySQL) with data warehouses (such as Redshift). However, AWS provides zero ETL integration solutions that have completely changed this situation, providing a simplified, near-real-time solution for data migration from RDSMySQL to Redshift. This article will dive into RDSMySQL zero ETL integration with Redshift, explaining how it works and the advantages it brings to data engineers and developers.

LaravelEloquent Model Retrieval: Easily obtaining database data EloquentORM provides a concise and easy-to-understand way to operate the database. This article will introduce various Eloquent model search techniques in detail to help you obtain data from the database efficiently. 1. Get all records. Use the all() method to get all records in the database table: useApp\Models\Post;$posts=Post::all(); This will return a collection. You can access data using foreach loop or other collection methods: foreach($postsas$post){echo$post->

MySQL is suitable for beginners because it is simple to install, powerful and easy to manage data. 1. Simple installation and configuration, suitable for a variety of operating systems. 2. Support basic operations such as creating databases and tables, inserting, querying, updating and deleting data. 3. Provide advanced functions such as JOIN operations and subqueries. 4. Performance can be improved through indexing, query optimization and table partitioning. 5. Support backup, recovery and security measures to ensure data security and consistency.
