Home Database Mysql Tutorial CentOS服务器版本安装MySQL

CentOS服务器版本安装MySQL

Jun 07, 2016 pm 04:42 PM

在CentOS服务器版本下安装MySQL,首先这里说的是这里的路径,以及语句都是在网上看了很多错误后自己实践后修改过来的,希望对大家

在CentOS服务器版本下安装MySQL,,首先这里说的是这里的路径,以及语句都是在网上看了很多错误后自己实践后修改过来的,希望对大家有用。

相关参考:

感谢 杨鑫newlfe

这里在安装的时候要按着我的这个顺序,否则可能会因为路径错误而找不到相应的指令。

一、安装cmake
# 安装所需依赖包(这段指令是一直输入的)
yum -y install gcc libxml2-dev curl screen \
libpng12-dev autoconf libpcre3-dev make bzip2 \
libevent-dev patch libjpeg62-dev libcurl4-openssl-dev \
libfreetype6-dev g++ libtool libncurses5-dev psmisc lrzsz
 
# 下载文件
wget

# 编译安装
tar zxvf cmake-2.8.5.tar.gz
cd cmake-2.8.5
./boostrap
make && make install
cmake –version
 
二、 安装配置mysql
# 下载源文件
wget ://ftp.ntu.edu.tw/pub/MySQL/
 
# 创建用户和组
groupadd mysql
useradd -g mysql  -s /usr/sbin/nologin  mysql
 
# 创建安装目录
mkdir  /usr/local/ mysql
 
# 创建数据库目录
mkdir  /usr/local/ mysql/data
 
# 解压
tar -zxvf mysql-5.5.17.tar.gz
cd \mysql-5.5.17
 
# 编译及安装mysql
# cmake编译:
cmake .

//注意:

这里可能会报错,如果报错,那么就执行一下语句后在进行编译:

rm -f CMakeCache.txt

 

yum install ncurses-devel


# 安装mysql
make && make install
 
# 复制配置文件
cp support-files/my-medium.cnf  /etc/my.cnf
 
# 设置权限
chmod +x /usr/local/mysql
chown -R mysql.mysql /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql/data
 
# 配置开机自启动
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig -- add mysqld
chkconfg mysqld on
 
# 修改my.cnf配置
vim /etc/my.cnf
# [mysqld] 添加:
datadir=/usr/local/mysql/data
default-storage-engine=MyISAM
 
# 以下可选:
log-error =/usr/local/mysql/data/error.log
pid-file = /usr/local/mysql/data/mysql.pid
user = mysql
tmpdir = /tmp
 
# 初始化数据库
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data &
 
# 启动MySQL
/usr/local/mysql/bin/mysqld_safe  --defaults-file=/etc/my.cnf &
或者:
/etc/init.d/mysql start (service mysql start)
 
# 测试MySQL是否启动
# 1)查看是否有进程mysql
ps -ef | grep mysql
# 2)查看端口是否运行
netstat -tnl | grep 3306
# 3)读取mysql版本信息
/usr/local/mysql/bin/mysqladmin version
 
# 至此,MySQL安装完成

--------------------------------------分割线 --------------------------------------

用mysqldump和mysqlbinlog的MySQL数据恢复实验

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通用二进制安装

--------------------------------------分割线 --------------------------------------

本文永久更新链接地址:

Statement of this Website
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

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How do you alter a table in MySQL using the ALTER TABLE statement? How do you alter a table in MySQL using the ALTER TABLE statement? Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

How do I configure SSL/TLS encryption for MySQL connections? How do I configure SSL/TLS encryption for MySQL connections? Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

How do you handle large datasets in MySQL? How do you handle large datasets in MySQL? Mar 21, 2025 pm 12:15 PM

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

Explain InnoDB Full-Text Search capabilities. Explain InnoDB Full-Text Search capabilities. Apr 02, 2025 pm 06:09 PM

InnoDB's full-text search capabilities are very powerful, which can significantly improve database query efficiency and ability to process large amounts of text data. 1) InnoDB implements full-text search through inverted indexing, supporting basic and advanced search queries. 2) Use MATCH and AGAINST keywords to search, support Boolean mode and phrase search. 3) Optimization methods include using word segmentation technology, periodic rebuilding of indexes and adjusting cache size to improve performance and accuracy.

How do you drop a table in MySQL using the DROP TABLE statement? How do you drop a table in MySQL using the DROP TABLE statement? Mar 19, 2025 pm 03:52 PM

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

How do you represent relationships using foreign keys? How do you represent relationships using foreign keys? Mar 19, 2025 pm 03:48 PM

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

How do you create indexes on JSON columns? How do you create indexes on JSON columns? Mar 21, 2025 pm 12:13 PM

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

See all articles