mysql安装
Posted wangguangtao
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql安装相关的知识,希望对你有一定的参考价值。
运维开发技术交流群欢迎大家加入一起学习(QQ:722381733)
前言:这里我使用的安装方式是(cmake编译),我选择的版本是:cmake-2.8.8.tar.gz、mysql-5.5.32.tar.gz
[[email protected] package]# ll total 29580 -rw-r--r-- 1 root root 5691656 May 29 11:52 cmake-2.8.8.tar.gz -rw-r--r-- 1 root root 24596474 May 29 11:53 mysql-5.5.32.tar.gz [[email protected] package]#
一、安装cmake
1、解压cmake压缩包
[[email protected] package]# tar xf cmake-2.8.8.tar.gz [[email protected] package]# ls cmake-2.8.8 cmake-2.8.8.tar.gz mysql-5.5.32.tar.gz [[email protected] package]#
2、解析
[[email protected] package]# cd cmake-2.8.8 [[email protected] cmake-2.8.8]# ./configure --------------------------------------------- CMake 2.8.8, Copyright 2000-2011 Kitware, Inc. Found GNU toolchain C compiler on this system is: gcc C++ compiler on this system is: g++ Makefile processor on this system is: gmake g++ is GNU compiler g++ has STL in std:: namespace g++ has ANSI streams g++ has streams in std:: namespace
3、安装
[[email protected] cmake-2.8.8]# echo $? 0 [[email protected] cmake-2.8.8]# gmake && gmake install Scanning dependencies of target cmIML_test [ 1%] Building C object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test.c.o [ 1%] Building C object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_ABI_C.c.o [ 1%] Building C object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_INT_C.c.o [ 1%] Building C object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_include_C.c.o [ 2%] Building CXX object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_ABI_CXX.cxx.o [ 2%] Building CXX object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_INT_CXX.cxx.o [ 2%] Building CXX object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_include_CXX.cxx.o
注:安装完成后,记得使用“echo $?”,检查下!输出0表示成功,输出1表示失败。
二、开始安装mysql
1、首先需要安装(ncurses-devel)依赖包
[[email protected] cmake-2.8.8]# cd .. [[email protected] package]# yum install ncurses-devel -y Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.zju.edu.cn * extras: centos.ustc.edu.cn * updates: mirrors.zju.edu.cn Resolving Dependencies --> Running transaction check ---> Package ncurses-devel.x86_64 0:5.9-14.20130511.el7_4 will be installed
#############安装完成后检查###########
[[email protected] package]# rpm -aq|grep ncurses-devel
ncurses-devel-5.9-14.20130511.el7_4.x86_64
[[email protected] package]#
2、解压mysql压缩包
[[email protected] package]# tar xf mysql-5.5.32.tar.gz [[email protected] package]# ls cmake-2.8.8 cmake-2.8.8.tar.gz mysql-5.5.32 mysql-5.5.32.tar.gz [[email protected] package]#
3、创建虚拟用户
[[email protected] package]# useradd mysql -s /sbin/nologin -M [[email protected] package]# id mysql uid=1000(mysql) gid=1000(mysql) groups=1000(mysql) [[email protected] package]#
4、配置解析
[[email protected] package]# cd mysql-5.5.32 [[email protected] mysql-5.5.32]# [[email protected] mysql-5.5.32]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5.32 -DMYSQL_DATADIR=/usr/local/mysql-5.5.32/data -DMYSQL_UNIX_ADDR=/usr/local/mysql-5.5.32/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii -DENABLED_LOCAL_INFILE=ON -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITHOUT_PARTITION_STORAGE_ENGINE=1 -DWITH_FAST_MUTEXES=1 -DWITH_ZLIB=bundled -DENABLED_LOCAL_INFILE=1 -DWITH_READLINE=1 -DWITH_EMBEDDED_SERVER=1 -DWITH_DEBUG=0
5、安装
[[email protected] mysql-5.5.32]# make && make install Scanning dependencies of target INFO_BIN [ 0%] Built target INFO_BIN Scanning dependencies of target INFO_SRC [ 0%] Built target INFO_SRC Scanning dependencies of target abi_check [ 0%] Built target abi_check Scanning dependencies of target zlib
6、创建软连接
[[email protected] mysql-5.5.32]# ln -s /usr/local/mysql-5.5.32/ /usr/local/mysql [[email protected] mysql-5.5.32]# readlink /usr/local/mysql /usr/local/mysql-5.5.32/ [[email protected] mysql-5.5.32]#
7、配置环境
[[email protected] mysql-5.5.32]# cd .. [[email protected] package]# echo ‘export PATH=/usr/local/mysql/bin:$PATH‘ >>/etc/profile [[email protected] package]# tail -1 /etc/profile export PATH=/usr/local/mysql/bin:$PATH [[email protected] package]# source /etc/profile [[email protected] package]# echo $PATH /usr/local/mysql/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin [[email protected] package]#
8、拷贝、查看、设置属主、及添加tmp权限
[[email protected] package]# \cp mysql-5.5.32/support-files/my-small.cnf /etc/my.cnf [[email protected] package]# ll /usr/local/mysql/data/ total 0 drwxr-xr-x 2 root root 20 May 31 11:51 test [[email protected] package]# chown -R mysql.mysql /usr/local/mysql/data/ [[email protected] package]# chmod -R 1777 /tmp/ [[email protected] package]#
9、初始化数据库
[[email protected] package]# cd /usr/local/mysql/scripts/ [[email protected] scripts]# ./mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --user=mysql Installing MySQL system tables... OK Filling help tables... OK
注:看到两个ok表示成功
以上是关于mysql安装的主要内容,如果未能解决你的问题,请参考以下文章
连接MySQL出现错误:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)(代码片段
使用 json rereiver php mysql 在片段中填充列表视图
在Tomcat的安装目录下conf目录下的server.xml文件中增加一个xml代码片段,该代码片段中每个属性的含义与用途
关于mysql驱动版本报错解决,Cause: com.mysql.jdbc.exceptions.jdbc4Unknown system variable ‘query_cache_size(代码片段