Centos5.5中安装Mysql5.5过程分享
网络编程 2021-07-05 15:28www.168986.cn编程入门
这篇文章主要介绍了Centos5.5中安装Mysql5.5过程分享,本文使用编译方法安装MySQL,并给出了一些可能遇到的错误和解决方法,需要的朋友可以参考下
这几天在centos下装mysql,这里记录一下安装的过程,方便以后查阅
Mysql5.5.37安装需要cmake,5.6版本开始都需要cmake来编译,5.5以后的版本应该也要装这个。
安装cmake
代码如下:
[root@local ~]# wget http://.cmake./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./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 inplete, errors ourred!
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 ~]# wget http://invisible-island./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_defaults
If you piled 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
level of the extracted archive, or pass the --basedir option
pointing 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.f/etc/my.f
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 -p
Enter password:
Wele 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)
编程语言
- 如何快速学会编程 如何快速学会ug编程
- 免费学编程的app 推荐12个免费学编程的好网站
- 电脑怎么编程:电脑怎么编程网咯游戏菜单图标
- 如何写代码新手教学 如何写代码新手教学手机
- 基础编程入门教程视频 基础编程入门教程视频华
- 编程演示:编程演示浦丰投针过程
- 乐高编程加盟 乐高积木编程加盟
- 跟我学plc编程 plc编程自学入门视频教程
- ug编程成航林总 ug编程实战视频
- 孩子学编程的好处和坏处
- 初学者学编程该从哪里开始 新手学编程从哪里入
- 慢走丝编程 慢走丝编程难学吗
- 国内十强少儿编程机构 中国少儿编程机构十强有
- 成人计算机速成培训班 成人计算机速成培训班办
- 孩子学编程网上课程哪家好 儿童学编程比较好的
- 代码编程教学入门软件 代码编程教程