位置:
首页>>
网站运营>> linux下使用cmake编译安装mysql的详细教程
linux下使用cmake编译安装mysql的详细教程
作者:Mr_wangB0 发布时间:2023-08-20 02:55:26
标签:linux,cmake,mysql
一、安装cmake
1、解压cmake压缩包
[root@mysql tools]# tar -zvxf cmake-2.8.8.tar.gz
[root@mysql tools]# ls
cmake-2.8.8 cmake-2.8.8.tar.gz mysql-5.5.16.tar.gz scripts
2、解析
[root@mysql tools]# cd cmake-2.8.8
[root@mysql cmake-2.8.8]# ./configure
---------------------------------------------
CMake 2.8.8, Copyright 2000-2009 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.8]# echo $?
0
#如果返回值是0,就是执行成功,如果返回值是1,就是执行失败;
[root@mysql 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
二、开始安装mysql
1、首先需要安装(ncurses-devel)依赖包
[root@mysql cmake-2.8.8]# cd …
[root@mysql tools]# yum -y install ncurses-devel
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
—> tools ncurses-devel.x86_64 0:5.9-14.20130511.el7_4 will be installed
#############安装完成后检查###########
[root@mysql tools]# rpm -qa | grep ncurses-devel
ncurses-devel-5.9-14.20130511.el7_4.x86_64
[root@mysql tools]#
2、解压mysql压缩包
[root@mysql tools]# tar -zvxf mysql-5.5.16.tar.gz
[root@mysql tools]# ls
cmake-2.8.8 cmake-2.8.8.tar.gz mysql-5.5.16 mysql-5.5.16.tar.gz scripts
[root@mysql tools]#
3、创建虚拟用户
[root@mysql tools]# useradd mysql -s /sbin/nologin -M
[root@mysql tools]# id mysql
uid=1000(mysql) gid=1000(mysql) groups=1000(mysql)
[root@mysql tools]#
4、配置解析
[root@mysql tools]# cd mysql-5.5.16
[root@mysql mysql-5.5.16]#
[root@mysql mysql-5.5.16]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5.16 -DMYSQL_DATADIR=/usr/local/mysql-5.5.16/data -DMYSQL_UNIX_ADDR=/usr/local/mysql-5.5.16/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、安装
[root@mysql mysql-5.5.16]# 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、创建软连接
[root@mysql mysql-5.5.16]# ln -s /usr/local/mysql-5.5.16/ /usr/local/mysql
[root@mysql mysql-5.5.16]# readlink /usr/local/mysql
/usr/local/mysql-5.5.16/
[root@mysql mysql-5.5.16]#
7、配置环境
[root@mysql mysql-5.5.16]# cd …
[root@mysql tools]# echo ‘export PATH=/usr/local/mysql/bin:$PATH' >>/etc/profile
[root@mysql tools]# tail -1 /etc/profile
export PATH=/usr/local/mysql/bin:$PATH
[root@mysql tools]# source /etc/profile
[root@mysql tools]# echo $PATH
/usr/local/mysql/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@mysql tools]#
8、拷贝、查看、设置属主、及添加tmp权限
[root@mysql tools]# \cp mysql-5.5.16/support-files/my-small.cnf /etc/my.cnf
[root@mysql tools]# ll /usr/local/mysql/data/
total 0
drwxr-xr-x 2 root root 20 May 31 11:51 test
[root@mysql tools]# chown -R mysql.mysql /usr/local/mysql/data/
[root@mysql tools]# chmod -R 1777 /tmp/
[root@mysql tools]#
9、初始化数据库
[root@mysql tools]# 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 /roottools/mysql-5.5.16
[root@mysql mysql-5.5.16]# cp support-files/mysql.server /etc/init.d/mysqld
[root@mysql mysql-5.5.16]# chmod -R 755 /etc/init.d/mysqld
[root@mysql mysql-5.5.16]# chkconfig --add mysqld
[root@mysql mysql-5.5.16]# chkconfig mysqld on
[root@mysql mysql-5.5.16]# 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 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@mysql mysql-5.5.16]#
11、启动mysql数据库
[root@mysql mysql-5.5.16]# /etc/init.d/mysqld start
Starting MySQL… SUCCESS!
[root@mysql mysql-5.5.16]#
12、查看端口进程
[root@mysql mysql-5.5.16]# lsof -i:3306
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 51146 mysql 10u IPv4 82600 0t0 TCP :mysql (LISTEN)
[root@mysql mysql-5.5.16]# netstat -lnutp|grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0: LISTEN 51146/mysqld
[root@mysql mysql-5.5.16]# ps -ef|grep 3306
mysql 51146 50900 0 14:13 pts/1 00:00:00 /usr/local/mysql-5.5.16/bin/mysqld --basedir=/usr/local/mysql-5.5.16 --datadir=/usr/local/mysql-5.5.16/data --plugin-dir=/usr/local/mysql-5.5.16/lib/plugin --user=mysql --log-error=/usr/local/mysql-5.5.16/data/mysql.err --pid-file=/usr/local/mysql-5.5.16/data/mysql.pid --socket=/usr/local/mysql-5.5.16/tmp/mysql.sock --port=3306
root 51170 16240 0 14:14 pts/1 00:00:00 grep --color=auto 3306
[root@mysql mysql-5.5.16]#
注:如果要重新初始化只要删除data目录库文件存储地或者新建一个库文件存储地,重新初始化,提示两个ok就是成功
进入数据库
[root@localhost ~]# mysql
查看所有用户
mysql> use mysql
mysql> show tables;
mysql> select user,host from user;
删除系统默认的
delete from mysql.user where user='';
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 |
±-----±----------+
2 rows in set (0.00 sec)
mysql>
#########################
添加额外的授权管理员用户
grant all privileges on . to system@‘192.168.%' identified by ‘system' with grant option;
字符集路径
vi /etc/locale.conf #centos7
mysql创建密码
/application/mysql//bin/mysqladmin -u root password ‘123456'
mysql修改密码
/application/mysql//bin/mysqladmin -u root -p123456 password ‘112233'
总结
以上所述是小编给大家介绍的linux下使用cmake编译安装mysql的详细教程,希望对大家有所帮助
来源:https://blog.csdn.net/Mr_wangB0/article/details/102662583
猜你喜欢
之前听一高手说过,赚钱要高调,赚钱的方法要低调,今天我也高调一小下吧。方法也会顺便点一下,若能悟到,以后您赚钱了要记得范士武啊。一次小聚,一
DNS是一个层次化的数据库,它包括一系列记录,描述了名称、IP地址和其他关于主机的信息。这些数据库驻留在DNS服务器中,DNS服务器和Int
WebP(发音:weppy)是一种同时提供了有损压缩与无损压缩(可逆压缩)的图片文件格式,派生自影像编码格式VP8,被认为是WebM多媒体格
把你的Web服务器与应用服务器、脚本语言进行无痛整合。对于WebBase服务器,把你的Web前端与数据库后端连接起来是件很轻松的事。使用Ex
第一步:用游览器打开以下网址(如果你的网域名是别的就把abc.com换成你的域名)http://www.alexa.com/data/det
以前帮客户做好网站之后就轻松了,基本上不用再管,如果有什么问题,也只是负责修改某些功能而已,基本上牵扯不到网站的运营推广,哪些都是他们的事情
[xmail@xmail log]$ telnet smtp.263.net 25Trying 211.150.96.25...Connec
允许Web用户访问数据库是一项很精细的工作,需要认真的考虑,不能马虎从事。TechRepublic会员E Spigle 最近在TechRep
邮件服务器是一个通过网络为多用户服务的软件系统,开发厂商不但根据所满足业务量的不同,推出类型不同的版本,还随着网络技术的进步不断发布产品的升
最近探讨flash在客户端的得失,与几位朋友交流时,突然想起,前段时间阿里集团旗下几个公司相继做出在业内反响比较大的几个招聘网站,不约而同都
1. 什么是PageRank 2. PageRank的决定因素 3. 如何查知PageRank 4. PageRank的重要性 5. Goo
用法:date [选项]... [+格式] 或:date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][
为什么要包含头文件而不是.c文件测试代码:m.c文件:#include"t.c"int main(){test();re
本文记录了centos 7 安装详细教程,供大家参考,具体内容如下1.centos 7 下载地址进入镜像下载主页:直接点击官方主页中的&qu
近来小站遇到了盗链问题,至使网站的流量枉费流失,于是被迫准备为服务器安装防盗链机制以挽救本就不宽裕的带宽。通过G.CN和B.CN搜索后得出了
北京时间10月23日消息,巨人网络今年的战略新品《绿色征途》今日正式启动封测。巨人网络董事长兼CEO史玉柱表示,该游戏是其对免费网游进行两年
1.Sun xVM VirtualBox简介VirtualBox官方网站:http://www.virtualbox.org &n
Webbench是一个非常简单的压力测试工具,Webbench最多可以模拟3万个并发连接去测试网站的负载能力。(1)Webbench安装wg
有用户咨询GoDaddy的Linux主机如何设置高级目录权限,在此整理了份详细的教程更您参考。1、登陆你的Account Manager.2
顾名思义,人肉搜索就是利用现代信息科技,变传统的网络信息搜索为人找人、人问人、 * 、人挤人、人挨人的关系型网络社区活动,变枯燥乏味的查询过