GDB调试Mysql实战之源码编译安装
2019/6/30 18:02:38
本文主要是介绍GDB调试Mysql实战之源码编译安装,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
下载源码
git clone https://github.com/mysql/mysql-server.git cd mysql-server git 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=<directory> -DWITH_DEBUG=1 -DWITH_UNIT_TESTS=off make make install
最后程序安装到了/usr/local/mysql
目录
创建专用用户
groupadd mysql useradd -s /sbin/nologin -M -g mysql mysql
初始化数据库
cd /usr/local/mysql/ bin/mysqld --defaults-file=/etc/my.cnf --initialize --user=mysql 2019-02-01T07:45:58.147032Z 1 [Note] A temporary password is generated for root@localhost: jss<swtX.8og
连接数据库
[root@bogon bin]# ./mysql -h localhost -uroot ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
原来是因为配置文件里面没有置顶客户端的 socket 文件
cat /etc/my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-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.log pid-file=/var/run/mariadb/mariadb.pid # # include all files from the config directory # !includedir /etc/my.cnf.d
增加
[client] default-character-set=utf8 socket=/var/lib/mysql/mysql.sock [mysql] default-character-set=utf8 socket=/var/lib/mysql/mysql.sock
再次连接就 ok 了。
修改默认密码
SET PASSWORD = PASSWORD('123456'); ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER; flush privileges;
导入测试数据
/usr/local/mysql/bin/mysql -uroot -p123456 test < article_rank.sql
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对找一找教程网的支持。如果你想了解更多相关内容请查看下面相关链接
这篇关于GDB调试Mysql实战之源码编译安装的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-05-29阿里 Canal 实时同步 MySQL 增量数据至 ClickHouse 数据库
- 2024-05-24在Linux下管理MySQL的大小写敏感性
- 2024-04-26MySQL查出时间比实际晚8小时的解决方案
- 2024-04-01JPA不识别MySQL的枚举类型
- 2024-03-30mysql数据库表卡死解决方法
- 2024-03-15MySQL多数据源笔记5-ShardingJDBC实战
- 2024-03-11natural join mysql
- 2024-03-11关于VS2017,VS2015 中利用 EF使用Mysql 不显示数据源问题解决方案
- 2024-02-26mysql 阿里云xb后缀备份文件恢复-icode9专业技术文章分享
- 2024-02-22docker mysql 5.7