GDB debugging MySQL actual combat source code compilation and installation

GDB debugging MySQL actual combat source code compilation and installation

Download source code

git clone https://github.com/mysql/mysql-server.git
cd mysql-server
git checkout 5.7

Compile and install

Install Dependencies

yum install -y cmake make gcc gcc-c++ ncurses-devel bison gdb

One thing to note is that you need to specify the boost path, which will be automatically downloaded when cmake is run.

cd BUILD; 
cmake .. -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory> -DWITH_DEBUG=1 -DWITH_UNIT_TESTS=off
make 
make install

Finally, the program is installed in the /usr/local/mysql directory

Create a dedicated user

groupadd mysql
useradd -s /sbin/nologin -M -g mysql mysql

Initialize the database

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

Connecting to a database

[root@bogon bin]# ./mysql -h localhost -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

It turns out that the client socket file is not pinned in the configuration file.

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

Increase

[client]
default-character-set=utf8
socket=/var/lib/mysql/mysql.sock
[mysql]
default-character-set=utf8
socket=/var/lib/mysql/mysql.sock

Connect again and it's ok.

Change the default password

SET PASSWORD = PASSWORD('123456');
ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
flush privileges;

Importing test data

/usr/local/mysql/bin/mysql -uroot -p123456 test < article_rank.sql

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links

You may also be interested in:
  • Mysql LONGBLOB type stores binary data (modification + debugging + sorting)
  • Mysql LONGTEXT type stores large files (binary is also possible) (modification + debugging + sorting)
  • Mysql insert Chinese and Chinese query (modification + debugging)
  • Novice configuration PHP debugging environment (IIS+PHP+MYSQL)
  • Related methods of MySQL UDF debugging mode debugview
  • Share 101 MySQL debugging and optimization tips
  • How MLSQL Stack makes stream debugging easier

<<:  Install Docker for Windows on Windows 10 Home Edition

>>:  JavaScript canvas to achieve code rain effect

Recommend

A brief analysis of the best way to deal with forgotten MySQL 8 passwords

Preface Readers who are familiar with MySQL may f...

Summary of the data storage structure of the nginx http module

Starting from this section, we will explain the i...

How to set the number of mysql connections (Too many connections)

During the use of mysql, it was found that the nu...

3 functions of toString method in js

Table of contents 1. Three functions of toString ...

How to solve the problem that Docker container has no vim command

Find the problem Today, when I tried to modify th...

The difference between this.$router and this.$route in Vue and the push() method

The official document states: By injecting the ro...

Detailed explanation of CentOS configuration of Nginx official Yum source

I have been using the CentOS purchased by Alibaba...

Six methods for nginx optimization

1. Optimize Nginx concurrency [root@proxy ~]# ab ...

How to use firewall iptables strategy to forward ports on Linux servers

Forwarding between two different servers Enable p...

How to delete garbled or special character files in Linux

Due to encoding reasons, garbled characters will ...

Before making a web page, let’s take a look at these so-called specifications

This article has compiled some so-called specific...

How to change the CentOS server time to Beijing time

1. I purchased a VPS and CentOS system, and found...

Mini Program to Implement Calculator Function

This article example shares the specific code of ...