您好,登錄后才能下訂單哦!
這篇文章將為大家詳細(xì)講解有關(guān)GDB調(diào)試Mysql實(shí)戰(zhàn)之源碼編譯安裝的實(shí)例分析,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
下載源碼
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
需要注意的一點(diǎn),需要指定 boost 路徑,會(huì) cmake 的時(shí)候自動(dòng)下載
cd BUILD; cmake .. -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory> -DWITH_DEBUG=1 -DWITH_UNIT_TESTS=off make make install
最后程序安裝到了/usr/local/mysql
目錄
創(chuàng)建專用用戶
groupadd mysql useradd -s /sbin/nologin -M -g mysql mysql
初始化數(shù)據(jù)庫
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
連接數(shù)據(jù)庫
[root@bogon bin]# ./mysql -h localhost -uroot ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
原來是因?yàn)榕渲梦募锩鏇]有置頂客戶端的 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 了。
修改默認(rèn)密碼
SET PASSWORD = PASSWORD('123456'); ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER; flush privileges;
導(dǎo)入測(cè)試數(shù)據(jù)
/usr/local/mysql/bin/mysql -uroot -p123456 test < article_rank.sql
關(guān)于“GDB調(diào)試Mysql實(shí)戰(zhàn)之源碼編譯安裝的實(shí)例分析”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。