运维开发技术交流群欢迎大家加入一起学习(QQ:722381733)

前言:这里我使用的安装方式是(cmake编译),我选择的版本是:cmake-2.8.8.tar.gz、mysql-5.5.32.tar.gz

[root@mysql package]# ll
total
-rw-r--r-- root root May : cmake-2.8..tar.gz
-rw-r--r-- root root May : mysql-5.5..tar.gz
[root@mysql package]#

一、安装cmake

  1、解压cmake压缩包

[root@mysql package]# tar xf cmake-2.8..tar.gz
[root@mysql package]# ls
cmake-2.8. cmake-2.8..tar.gz mysql-5.5..tar.gz
[root@mysql package]#

  2、解析

[root@mysql package]# cd cmake-2.8.
[root@mysql cmake-2.8.]# ./configure
---------------------------------------------
CMake 2.8., Copyright - 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、安装

[root@mysql cmake-2.8.]# echo $?

[root@mysql cmake-2.8.]# gmake && gmake install
Scanning dependencies of target cmIML_test
[ %] Building C object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test.c.o
[ %] Building C object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_ABI_C.c.o
[ %] Building C object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_INT_C.c.o
[ %] Building C object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_include_C.c.o
[ %] Building CXX object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_ABI_CXX.cxx.o
[ %] Building CXX object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_INT_CXX.cxx.o
[ %] Building CXX object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_include_CXX.cxx.o

  注:安装完成后,记得使用“echo $?”,检查下!输出0表示成功,输出1表示失败。

二、开始安装mysql 

  1、首先需要安装(ncurses-devel)依赖包

[root@mysql cmake-2.8.]# cd ..
[root@mysql 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 :5.9-14.20130511.el7_4 will be installed
#############安装完成后检查###########
[root@mysql package]# rpm -aq|grep ncurses-devel
ncurses-devel-5.9-14.20130511.el7_4.x86_64
[root@mysql package]#

  2、解压mysql压缩包

[root@mysql package]# tar xf mysql-5.5..tar.gz
[root@mysql package]# ls
cmake-2.8. cmake-2.8..tar.gz mysql-5.5. mysql-5.5..tar.gz
[root@mysql package]#

  3、创建虚拟用户

[root@mysql package]# useradd mysql -s /sbin/nologin -M
[root@mysql package]# id mysql
uid=(mysql) gid=(mysql) groups=(mysql)
[root@mysql package]#

  4、配置解析

[root@mysql package]# cd mysql-5.5.
[root@mysql mysql-5.5.]#
[root@mysql mysql-5.5.]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5. -DMYSQL_DATADIR=/usr/local/mysql-5.5./data -DMYSQL_UNIX_ADDR=/usr/local/mysql-5.5./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= -DWITH_FEDERATED_STORAGE_ENGINE= -DWITH_BLACKHOLE_STORAGE_ENGINE= -DWITHOUT_EXAMPLE_STORAGE_ENGINE= -DWITHOUT_PARTITION_STORAGE_ENGINE= -DWITH_FAST_MUTEXES= -DWITH_ZLIB=bundled -DENABLED_LOCAL_INFILE= -DWITH_READLINE= -DWITH_EMBEDDED_SERVER= -DWITH_DEBUG=

  5、安装

[root@mysql mysql-5.5.]# make && make install
Scanning dependencies of target INFO_BIN
[ %] Built target INFO_BIN
Scanning dependencies of target INFO_SRC
[ %] Built target INFO_SRC
Scanning dependencies of target abi_check
[ %] Built target abi_check
Scanning dependencies of target zlib

  6、创建软连接

[root@mysql mysql-5.5.]# ln -s /usr/local/mysql-5.5./ /usr/local/mysql
[root@mysql mysql-5.5.]# readlink /usr/local/mysql
/usr/local/mysql-5.5./
[root@mysql mysql-5.5.]#

  7、配置环境

[root@mysql mysql-5.5.]# cd ..
[root@mysql package]# echo 'export PATH=/usr/local/mysql/bin:$PATH' >>/etc/profile
[root@mysql package]# tail - /etc/profile
export PATH=/usr/local/mysql/bin:$PATH
[root@mysql package]# source /etc/profile
[root@mysql package]# echo $PATH
/usr/local/mysql/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@mysql package]#

  8、拷贝、查看、设置属主、及添加tmp权限

[root@mysql package]# \cp mysql-5.5./support-files/my-small.cnf /etc/my.cnf
[root@mysql package]# ll /usr/local/mysql/data/
total
drwxr-xr-x root root May : test
[root@mysql package]# chown -R mysql.mysql /usr/local/mysql/data/
[root@mysql package]# chmod -R /tmp/
[root@mysql package]#

  9、初始化数据库

[root@mysql package]# cd /usr/local/mysql/scripts/
[root@mysql 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表示成功

  10、设置开机启动

[root@mysql scripts]# cd /package/mysql-5.5.
[root@mysql mysql-5.5.]# /bin/cp support-files/mysql.server /etc/init.d/mysqld
[root@mysql mysql-5.5.]# chmod +x /etc/init.d/mysqld
[root@mysql mysql-5.5.]# chkconfig --add mysqld
[root@mysql mysql-5.5.]# chkconfig mysqld on
[root@mysql mysql-5.5.]# chkconfig --list mysqld Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration. If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'. mysqld :off :off :on :on :on :on :off
[root@mysql mysql-5.5.]#

  11、启动mysql数据库

[root@mysql mysql-5.5.]# /etc/init.d/mysqld start
Starting MySQL.. SUCCESS!
[root@mysql mysql-5.5.]#

  12、查看端口进程

[root@mysql mysql-5.5.]# lsof -i:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld mysql 10u IPv4 0t0 TCP *:mysql (LISTEN)
[root@mysql mysql-5.5.]# netstat -lnutp|grep
tcp 0.0.0.0: 0.0.0.0:* LISTEN /mysqld
[root@mysql mysql-5.5.]# ps -ef|grep
mysql : pts/ :: /usr/local/mysql-5.5./bin/mysqld --basedir=/usr/local/mysql-5.5. --datadir=/usr/local/mysql-5.5./data --plugin-dir=/usr/local/mysql-5.5./lib/plugin --user=mysql --log-error=/usr/local/mysql-5.5./data/mysql.err --pid-file=/usr/local/mysql-5.5./data/mysql.pid --socket=/usr/local/mysql-5.5./tmp/mysql.sock --port=
root : pts/ :: grep --color=auto
[root@mysql mysql-5.5.]#

注:如果要重新初始化只要删除data目录库文件存储地或者新建一个库文件存储地,重新初始化,提示两个ok就是成功

##这里就基本上安装好了,有没有觉得比make&&make install高大上一点哈,下面是一些mysql的优化。

  三、mysql数据的一些小优化

这里就不一一说明了,主要是自己懒而且菜,希望能满足大伙的工作要求

进入数据库
mysql 查看所有用户
select user,host from mysql.user; (方式一)删除系统默认的
delete from mysql.user where user='';
delete from mysql.user where host='主机名';
delete from mysql.user where host='::1';
select user,host from mysql.user; ##### 只保留这两个 #######
mysql> select user,host from mysql.user;
+------+-----------+
| user | host |
+------+-----------+
| root | 127.0.0.1 |
| root | localhost |
+------+-----------+
rows in set (0.00 sec) mysql>
######################### 删除test库
drop database test;
show databases; (方式二)干脆把全部删除了,添加额外的管理员 删除全部用户
delete from mysql.user; 添加额外的授权管理员用户
grant all privileges on *.* to system@'localhost' identified by '' with grant option; 字符集路径
vi /etc/locale.conf #centos7 vi /etc/sysconfig/il8n #centos6 mysql创建密码
/application/mysql//bin/mysqladmin -u root password '123456' mysql修改密码
/application/mysql//bin/mysqladmin -u root -poldboy123 password '112233'

cmake编译安装mysql的更多相关文章

  1. cmake编译安装mysql 5.6.12

    cmake安装mysql 5.6.12 从mysql 5.5 开始就要用cmake编译安装 下载mysql 下载地址:http://pan.baidu.com/s/1o68xxqE 一.安装mysql ...

  2. CentOS下使用cmake编译安装mysql

    一.下载安装所必需的依赖包 1.因为高版本mysql都用cmake安装,所以下载cmake wget http://www.cmake.org/files/v3.0/cmake-3.0.1.tar.g ...

  3. 源码编译安装 MySQL 5.5.x 实践

    1.安装cmakeMySQL从5.5版本开始,通过./configure进行编译配置方式已经被取消,取而代之的是cmake工具.因此,我们首先要在系统中源码编译安装cmake工具. # wget ht ...

  4. 基于cmake编译安装MySQL-5.5

    cmake的重要特性之一是其独立于源码(out-of-source)的编译功能,即编译工作可以在另一个指定的目录中而非源码目录中进行,这可以保证源码目录不受任何一次编译的影响,因此在同一个源码树上可以 ...

  5. CentOS 编译安装 mysql

    1.前期准备 1.1 环境说明: 操作系统: CentOS release 6.4 (Final) [查看命令 cat /etc/redhat-release ] mysql : mysql-5.6. ...

  6. Linux CentOS6.5下编译安装MySQL 5.6.16【给力详细教程】

    一.编译安装MySQL前的准备工作 安装编译源码所需的工具和库 yum install gcc gcc-c++ ncurses-devel perl 安装cmake,从http://www.cmake ...

  7. Linux编译安装Mysql步骤

    一. Centos 用 wget 下载需要的软件,保存到目录/home/zwl/MySql/下 wget http://dev.mysql.com/get/Downloads/MySQL-5.5/my ...

  8. CentOS下编译安装MySQL 5.6.21

    一.编译安装MySQL前的准备工作 安装编译源码所需的工具和库 yum install gcc gcc-c++ ncurses-devel perl 安装cmake:http://www.cnblog ...

  9. 源码编译安装 MySQL 5.5.x 实践(转)

    1.安装cmakeMySQL从5.5版本开始,通过./configure进行编译配置方式已经被取消,取而代之的是cmake工具.因此,我们首先要在系统中源码编译安装cmake工具. # wget ht ...

随机推荐

  1. Tcl学习之--命名空间

    Tcl解释器将全部的命令和全局变量分组管理.这些小组称为命名空间,一个命名空间中的命令和变量不会影响到还有一个命名空间.这些命名空间呈树形组织.一个命名空间的命令能够被还有一个命名空间引入.命名空间树 ...

  2. MyEclipse中加入web项目到tomcat

    假设导入不是在MyEclipse下建立的web项目,想加入到tomcat中时,会显示"No projects are available for deployment to this ser ...

  3. C++链表冒泡,归并,插入排序(纯指针)

    #include <iostream> using namespace std; //别问我为什么要写链表的冒泡排序. struct Node { int data; Node *next ...

  4. coffeescript的上下文

    CoffeeScript代码中,变量,甚至函数前面有时会带上一个@符号,那么翻译到 javascript里,就是 "this." 这就涉及到运行过程中的上下文. 这个this指什么 ...

  5. oc75--不可变字典NSDictionary

    // // main.m // NSDictionary // // #import <Foundation/Foundation.h> int main(int argc, const ...

  6. git分支的合并和冲突解决【转】

    本文转载自:http://blog.csdn.net/Kingson_Wu/article/details/39227611 http://gitbook.liuhui998.com/3_3.html ...

  7. linux C函数之strdup函数分析【转】

    本文转载自:http://blog.csdn.net/tigerjibo/article/details/12784823 linux C函数之strdup函数分析 一.函数分析 1.函数原型: #i ...

  8. --NSArray与NSMutableArray用copy修饰还是strong(转)

    一.NSMutableArray 被copy.strong修饰后的变化: 把NSMutableArray用copy修饰有时就会crash,因为对这个数组进行了增删改操作,而copy后的数组变成了不可变 ...

  9. mysql在linux下的安装(5.7版本以后)

    1.添加mysql组和mysql用户,用于设置mysql安装目录文件所有者和所属组. ①groupadd mysql ②useradd -r -g mysql mysql 2.将二进制文件解压到指定的 ...

  10. flask 中的模板语法 jinja2及render_template的深度用法

    是时候开始写个前端了,Flask中默认的模板语言是Jinja2 现在我们来一步一步的学习一下 Jinja2 捎带手把 render_template 中留下的疑问解决一下 首先我们要在后端定义几个字符 ...