使用codeblocks调试mysql

codeblocks调试mysql环境搭建

1.将mysql-5.6.23.zip解压到用户根目录~/

2.在用户根目录~/,新建文件夹build和mysql

3.打开codeblocks,新建空工程,工程名输入mysql,Folder to create project in:选择~/build,点击next,再点击finish

4.选择mysql工程,project->add file recursively,选择~/mysql-5.6.23目录,wildcard select中添加*.ic,*.ih,点击OK

5.~/build目录下执行如下命令
    cmake ../mysql-5.6.23 \
        -DCURSES_LIBRARY=/usr/lib/x86_64-linux-gnu/ \
        -DCURSES_INCLUDE_PATH=/usr/include/ \
        -DCMAKE_INSTALL_PREFIX=~/mysql/ \
        -DMYSQL_DATADIR=~/mysql/data \
        -DDEFAULT_CHARSET=utf8 \
        -DDEFAULT_COLLATION=utf8_general_ci \
        -DEXTRA_CHARSETS=all \
        -DENABLED_LOCAL_INFILE=1


6.project->properties->project setting中勾选This is custom Makefile,Execution directory选择~/build目录,即../../build

7.project->build options->Debug->make commands去掉$target,build project/target:的make后加-j4,点击OK

8.build->build

9.~/build目录下执行make install


10.~/mysql目录下执行scripts/mysql_install_db --user=mysql

11.project->properies->build targets,将output filename修改为../sql/mysqld,即~/build/sql/mysqld

12.设置断点,debug->start/continue

13.~/mysql/bin目录下执行./mysqladmin -u root -p password 123456,修改后密码为123456

14.~/mysql/bin目录下执行./mysql -uroot -p登录

15.执行如下命令,使可以远程连接
    use mysql;
    update user set host = ‘%‘ where user = ‘root‘ and host = ‘hp‘;
    flush privileges;

16.修改远程连接密码
    update user set password=password(‘123456‘) where user=‘root‘ and host = ‘%‘;
    flush privileges;

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。