Centos 5.5 安装Mysql5.5过程

这几天在centos下装mysql,这里记录一下安装的过程,方便以后查阅

Mysql5.5.37安装需要cmake,5.6版本开始都需要cmake来编译,5.5以后的版本应该也要装这个。

安装cmake

[[email protected] ~]# wget http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz
[[email protected] ~]# tar xvf cmake-2.8.12.2.tar.gz
[[email protected] ~]# cd cmake-2.8.12.2
[[email protected] cmake-2.8.12.2]#./bootstrap
[[email protected] cmake-2.8.12.2]# make
[[email protected] cmake-2.8.12.2]# make install

安装mysql

[[email protected] ~]# wget http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.37.tar.gz
[[email protected] ~]# tar xvf mysql-5.5.37.tar.gz
[[email protected] ~]# cd mysql-5.5.37
[[email protected] mysql-5.5.37]# cmake ./

可能还会报这个错,没有就跳过

CMake Error at cmake/readline.cmake:83(MESSAGE):
Curses library not found.  Pleaseinstall appropriate package,
remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name islibncurses5-dev, on Redhat and derivates it is ncurses-devel.
Call Stack (most recent call first):
 cmake/readline.cmake:127 (FIND_CURSES)
 cmake/readline.cmake:217 (MYSQL_USE_BUNDLED_LIBEDIT)
 CMakeLists.txt:355 (MYSQL_CHECK_READLINE
-- Configuring incomplete, errors occurred!
See also "/root/my/mysql-5.5.37/CMakeFiles/CMakeOutput.log".
See also"/root/my/mysql-5.5.37/CMakeFiles/CMakeError.log".

说明centos系统没有ncurses-devel

[[email protected] ~]# wgethttp://invisible-island.net/datafiles/release/ncurses.tar.gz
[[email protected] ~]# cd ncurses-5.9
[[email protected] ncurses-5.9]#./configure
[[email protected] ncurses-5.9]# make
[[email protected] ncurses-5.9]# make install

再删除刚才编译生成的 CMakeCache.txt 文件,否则无法进行下一步

[[email protected] mysql-5.5.37]# rm -f CMakeCache.txt

继续编译mysql

[[email protected] ~]# cmake ./
[[email protected] ~]# make
[[email protected] ~]# make install

这样,mysql默认将成功安装到/usr/local/mysql

创建mysql用户组

[[email protected] ~]# groupadd mysql
[[email protected] ~]# useradd –r –g mysql mysql
[[email protected] ~]# chown –R mysql.mysql /usr/local/mysql

启动mysql

[[email protected] ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql

这里可能会发生错误,没有就跳过:

FATAL ERROR: Could not find./bin/my_print_defaults
If you compiled from source, you need torun ‘make install‘ to
copy the software into the correct locationready for operation.
If you are using a binary release, you musteither be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.

解决方法:

[[email protected] ~]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

再启动mysql

[[email protected] ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql

注册mysql服务,开机自动启动

1.设置mysql配置文件到/etc目录

[[email protected] ~]# cp /usr/local/mysql/support-files/my-medium.cnf/etc/my.cnf

2.设置mysql开机自启

[[email protected] ~]# cp/usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
[[email protected] ~]# chmod +x /etc/init.d/mysql
[[email protected] ~]# /sbin/chkconfig --add mysql

3.启动mysql服务

[[email protected] ~]# service mysql start

测试mysql是否安装成功

[[email protected] ~]# /usr/local/mysql/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.37 Source distribution

Copyright (c) 2000, 2014, Oracle and/or itsaffiliates. All rights reserved.

Oracle is a registered trademark of OracleCorporation and/or its
affiliates. Other names may be trademarksof their respective
owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ toclear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.03 sec)

参考:

http://blog.csdn.net/mycwq/article/details/24488691

Centos 5.5 安装Mysql5.5过程,码迷,mamicode.com

时间: 2024-12-27 13:20:36

Centos 5.5 安装Mysql5.5过程的相关文章

centos 下编译安装mysql5.1与mysql5.5

mysql5.1.60编译安装 1.tar -zxvf mysql* 2../configure 之前要make clean ./configure --prefix=/home/shk/mysql-5.1.60 \ --enable-local-infile \ --with-unix-socket-path=/home/shk/mysql-5.1.60/var/mysql.sock \ --with-tcp-port=5506 \ --enable-thread-safe-client \

centos下yum安装mysql5.6后,无法启动 MySQL Daemon failed to start

如果是全新安装应该就不会出现这个问题,升级安装的话,要运行 mysql_upgrade ,但是启动MYSQL就报错MySQL Daemon failed to start 如此就没办法运行mysql_upgrade升级MYSQL表了 因为是全新安装的数据库服务器就不管老数据了,直接把老的MYSQL数据库文件夹删除了,然后 运行 mysql_install_db 单独执行下命令,初始化mysql,test等数据库 初始化所有数据库以后,依然是无法启动,检查了MYSQL的日志发现没有权限,因为是RO

2014 Centos 6 minimal 安装mysql5

1.安装:#yum -y install mysql-server 2.修改配置:#vi /etc/my.cnf 暂时修改一下编码(添加在密码下方添加): default-character-set = utf8 # chkconfig mysqld on ← 设置MySQL服务随系统启动自启动# chkconfig –list mysqld ← 确认MySQL自启动mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off ← 如果2–5为on的状态就OK #se

Centos 6.2 安装mysql5.5

1.  安装mysql 相关依赖库(没有的话就安装,有就不用安装了) 通过 rpm -qa | grep name 的方式验证以下软件包是否已全部安装. gcc* gcc-c++* autoconf* automake* zlib* libxml* ncurses-devel* libmcrypt*   libtool* 没有的话安装: yum安装: #yum install bison gcc gcc-c++ autoconf automake zlib* libxml* ncurses-de

Centos 6.8安装mysql5.6

1.新开的云服务器,需要检测系统是否自带安装mysql # yum list installed | grep mysql 2.如果发现有系统自带mysql,果断这么干 # yum -y remove mysql-libs.x86_64 3.随便在你存放文件的目录下执行,这里解释一下,由于这个mysql的yum源服务器在国外,所以下载速度会比较慢,还好mysql5.6只有79M大,而mysql5.7就有182M了,所以这是我不想安装mysql5.7的原因 # wget http://repo.m

CentOS 7.0 安装 mysql-5.7.14

初学linux 路上遇过各种坑 把正确安装mysql-5.7.14分享一下 1.CentOs7.0 默认的数据库为MariaDB,先卸载MariaDB,否则安装mysql,引起冲突 先查看当前安装的MariaDB rpm -qa|grep mariadb 之后下面就会列出现在的版本 使用 rpm -e --nodeps mariadb........ 2.之后 创建文件夹 我是放在/home/mysql mkdir /home/mysql/data 3.创建mysql用户组与用户 groupad

centos系统下安装MySQL5.7.18

1.首先安装依赖包 yum install -y gcc gcc-c++ ncurses-devel perl openssl-devel 最最重要的是,不要忘了安装openssl-devel 2.安装cmake tar -xzvf cmake-3.8.1.tar.gz   cd cmake-3.8.1  ./bootstrapmake && make install 3.安装MySQL5.7.18 首先下载安装包,本人的安装版本是:mysql-boost-5.7.18.tar.gz 需要

CentOS 6.5 安装MySQL5.7 RPM

一.新特性 MySQL 5.7可谓是一个令人激动的里程碑,在默认了InnoDB引擎的基础上,新增了ssl.json.虚拟列等新特性.相对于postgreSQL和MariaDB而言,MySQL5.7做了大量“补短”操作. 特性详解: 原文:http://mysqlserverteam.com/whats-new-in-mysql-5-7-generally-available/ 翻译:http://www.oschina.net/translate/whats-new-in-mysql-5-7-g

centos 7 下安装mysql5.7

centos下默认安装mariadb数据库 1:将mariadb移除 yum search mysql; yum remove mariadb-libs.x86_64; 2:下载mysql源 wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm; 3:安装源 yum localinstall mysql57-community-release-el7-11.noarch.rpm; yum search