使用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;