GDB調(diào)試Mysql實戰(zhàn)之源碼編譯安裝
下載源碼
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
目錄
創(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)
原來是因為配置文件里面沒有置頂客戶端的 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)入測試數(shù)據(jù)
/usr/local/mysql/bin/mysql -uroot -p123456 test < article_rank.sql
總結(jié)
以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,謝謝大家對腳本之家的支持。如果你想了解更多相關(guān)內(nèi)容請查看下面相關(guān)鏈接
相關(guān)文章
MySQL中的聯(lián)合索引學(xué)習(xí)教程
這篇文章主要介紹了MySQL中的聯(lián)合索引學(xué)習(xí)教程,其中談到了聯(lián)合索引對排序的優(yōu)化等知識點,需要的朋友可以參考下2015-11-11HeidiSQL工具導(dǎo)出導(dǎo)入MySQL數(shù)據(jù)
這篇文章主要為大家詳細(xì)介紹了HeidiSQL工具導(dǎo)出導(dǎo)入MySQL數(shù)據(jù),具有一定的參考價值,感興趣的小伙伴們可以參考一下2019-05-05MySQL創(chuàng)建用戶和權(quán)限管理的方法
這篇文章主要介紹了MySQL創(chuàng)建用戶和權(quán)限管理的方法,文中示例代碼非常詳細(xì),幫助大家更好的理解和學(xué)習(xí),感興趣的朋友可以了解下2020-07-07找到一種不錯的從SQLServer轉(zhuǎn)成Mysql數(shù)據(jù)庫的方法
找到一種不錯的從SQLServer轉(zhuǎn)成Mysql數(shù)據(jù)庫的方法...2007-07-07mysql 8.0.15 版本安裝教程 連接Navicat.list
這篇文章主要為大家詳細(xì)介紹了mysql 8.0.15 版本安裝教程,連接Navicat.list,具有一定的參考價值,感興趣的小伙伴們可以參考一下2019-08-08mysql 5.7.17 安裝配置方法圖文教程(windows10)
這篇文章主要為大家分享了mysql 5.7.17 安裝配置方法圖文教程,具有一定的參考價值,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-01-01