hadoop编译源码安装_详解GDB调试Mysql实战之源码编译安装

本文详细介绍了如何从源码下载、编译及安装MySQL 5.7,包括依赖安装、指定Boost路径、编译选项设置、安装过程及后期的数据库初始化。在安装过程中遇到无法连接本地MySQL服务器的问题,原因是配置文件中未指定客户端的socket文件,通过添加socket配置后问题得到解决,最后还展示了如何修改默认密码并导入测试数据。
摘要由CSDN通过智能技术生成

下载源码

git clone https://github.com/mysql/mysql-server.gitcd mysql-servergit checkout 5.7

编译安装

安装依赖

yum install -y cmake make gcc gcc-c++ ncurses-devel bison gdb

需要注意的一点,需要指定 boost 路径,会 cmake 的时候自动下载

cd BUILD; cmake .. -DDOWNLOAD_BOOST=1 -DWITH_BOOST= -DWITH_DEBUG=1 -DWITH_UNIT_TESTS=offmake make install

最后程序安装到了/usr/local/mysql目录


创建专用用户

groupadd mysqluseradd -s /sbin/nologin -M -g mysql mysql

初始化数据库

cd /usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf --initialize --user=mysql2019-02-01T07:45:58.147032Z 1 [Note] A temporary password is generated for root@localhost: jss

连接数据库

[root@bogon bin]# ./mysql -h localhost -urootERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

原来是因为配置文件里面没有置顶客户端的 socket 文件

cat /etc/my.cnf[mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sock# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0# Settings user and group are ignored when systemd is used.# If you need to run mysqld under a different user or group,# customize your systemd unit file for mariadb according to the# instructions in http://fedoraproject.org/wiki/Systemd[mysqld_safe]log-error=/var/log/mariadb/mariadb.logpid-file=/var/run/mariadb/mariadb.pid## include all files from the config directory#!includedir /etc/my.cnf.d

增加

21a97fc8b7cc84ebc22a72c57ae452df.png

再次连接就 ok 了。

修改默认密码

1723105e64a7a2bf6dba8160eb981ccc.png

导入测试数据

/usr/local/mysql/bin/mysql -uroot -p123456 test < article_rank.sql

后面小编会分享更多运维干货,感兴趣的朋友走一波关注哩~

b0448624ca392e944892ff039c212f9f.gif
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值