桌面清理向导,千千静听官网,1hhhhhh
这几天在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 ~]# wget http://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_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.
解决方法:
[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 -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)
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
相关文章:
-
-
-
-
-
MySQL日期加减函数详解
1. addtime() 为日期加上指定秒数select addtime(now(),1); -- 加1秒2. adddate() 有两种用法,第二个参数直...
[阅读全文]
-
mysql累加计算实现方法详解
本文实例讲述了mysql累加计算。分享给大家供大家参考,具体如下:前言接了一个需求,产品想分析一下用户增长的曲线。也就是某个时间段的每日总人数列表。好对近期活动...
[阅读全文]
-
-
MySQL分区表的最佳实践指南
前言:分区是一种表的设计模式,通俗地讲表分区是将一大表,根据条件分割成若干个小表。但是对于应用程序来讲,分区的表和没有分区的表是一样的。换句话来讲,分区对于应用...
[阅读全文]
-
-
-
网友评论