Centos 5.5 安装Mysql5.5过程_MySQL

php中文网
发布: 2016-06-01 13:16:58
原创
1087人浏览过

CentOS

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

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

安装cmake

[root@local ~]# wget http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz[root@local ~]# tar xvf cmake-2.8.12.2.tar.gz[root@local ~]# cd cmake-2.8.12.2[root@local cmake-2.8.12.2]#./bootstrap[root@local cmake-2.8.12.2]# make[root@local cmake-2.8.12.2]# make install
登录后复制

 安装mysql

[root@local ~]# wget http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.37.tar.gz[root@local ~]# tar xvf mysql-5.5.37.tar.gz[root@local ~]# cd mysql-5.5.37[root@local 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

[root@local ~]# wgethttp://invisible-island.net/datafiles/release/ncurses.tar.gz[root@local ~]# cd ncurses-5.9[root@local ncurses-5.9]#./configure[root@local ncurses-5.9]# make[root@local ncurses-5.9]# make install
登录后复制

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

[root@local mysql-5.5.37]# rm -f CMakeCache.txt
登录后复制

继续编译mysql

[root@local ~]# cmake ./[root@local ~]# make[root@local ~]# make install
登录后复制

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

创建mysql用户组

[root@local ~]# groupadd mysql[root@local ~]# useradd –r –g mysql mysql[root@local ~]# chown –R mysql.mysql /usr/local/mysql
登录后复制
启动mysql
[root@local ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql
登录后复制
登录后复制

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

FATAL ERROR: Could not find./bin/my_print_defaultsIf you compiled from source, you need torun 'make install' tocopy the software into the correct locationready for operation.If you are using a binary release, you musteither be at the toplevel of the extracted archive, or pass the --basedir optionpointing to that location.
登录后复制

解决方法:

[root@local ~]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
登录后复制

再启动mysql

[root@local ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql
登录后复制
登录后复制

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

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

[root@local ~]# cp /usr/local/mysql/support-files/my-medium.cnf/etc/my.cnf
登录后复制

2.设置mysql开机自启

[root@local ~]# cp/usr/local/mysql/support-files/mysql.server /etc/init.d/mysql[root@local ~]# chmod +x /etc/init.d/mysql[root@local ~]# /sbin/chkconfig --add mysql
登录后复制

3.启动mysql服务

[root@local ~]# service mysql start
登录后复制

测试mysql是否安装成功

[root@local ~]# /usr/local/mysql/bin/mysql -u root -pEnter password: Welcome to the MySQL monitor.Commands end with ; or /g.Your MySQL connection id is 1Server 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 itsaffiliates. Other names may be trademarksof their respectiveowners. 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)
登录后复制

参考:

最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
相关标签:
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号