MySQL Initial commissioning

Source: Internet
Author: User
Tags mysql version

The first time so close to contact the source code, a little excited, and a little overwhelmed, a lot of the source files are thousands of lines, you say how to see, there are some countless data structures, functions, classes and other messy things.

The MySQL version I installed is 5.7.12, then the platform is CentOS 6.5 x64 (should be x64).

Start GDB

GDB--args/usr/local/mysql-5.7.12/bin/mysqld

You can also use the following, if you set a link

GDB--args mysqld

And then you get into the GDB environment.

Here we can add a breakpoint with the B function name

This breakpoint is a function I found in the source file of the mysqld.cc, casually looking for one.

Then use the following command to start the mysqld

Then is the gdb c,c meaning to continue meaning, just run--defaults-file=/etc/my.cnf--user=root has been running, and reached the breakpoint set Mysqld_main

If we use another client service MySQL status at this point

found that the MySQL service did not start

So we continue to enter command C in GDB.

...

And here is the wait mode, which does not appear (GDB)

And then on another client that can continue service MySQL status

Will find that the MySQL service has been started.

Continue to operate on this client, log in to MySQL

Mysql-uroot-hlocalhost-p

The discovery can be successfully logged in.

And then look at the debugging environment

You can see that a new thread has appeared and should be the thread that the client connects to.

Then exit Mysql,exit, found that the GDB environment has not changed, did not say the end of the thread or something.

But if we re-open a client log in to MySQL, another thread will be added

Shutting down the client still does not see signs of these two threads exiting.

When the MySQL service is closed on a client, service MySQL stop,

Will find this in gdb.

And then

Shutting down to MySQL ..... ..... ..... ................ This little bit of the infinite loop goes down

So in the GDB environment, enter command C

(GDB) ccontinuing.2016-05-03t10:49:28.524672z 0 [Note] innodb:page_cleaner:1000ms intended loop took 180093ms. The settings might not being optimal. (Flushed=0 and Evicted=0, during the time.) [Thread 0x7fff957fb700 (LWP 4113) exited] [Thread 0x7fffb8c82700 (LWP 4162) exited]2016-05-03t10:49:28.569814z 0 [Note] Giving 0 Client threads a chance to die Grac efully2016-05-03t10:49:28.569875z 0 [note] shutting down slave threads2016-05-03t10:49:28.569896z 0 [note] Forcefully Disconnecting 0 remaining clients2016-05-03t10:49:28.569912z 0 [Note] Event scheduler:purging the queue. 0 events[thread 0x7fffb8cc3700 (LWP 4135) exited]2016-05-03t10:49:28.578091z 0 [Note] Binlog end2016-05-03t10 : 49:28.581076z 0 [note] shutting down plugin ' Ngram ' 2016-05-03t10:49:28.581127z 0 [note] shutting down plugin ' ARCHIVE ' 201 6-05-03t10:49:28.581135z 0 [note] shutting down plugin ' partition ' 2016-05-03t10:49:28.581139z 0 [note] shutting down plug In ' Blackhole ' 2016-05-03t10:49:28.581170z 0 [Note] shutting down PlugiN ' CSV ' 2016-05-03t10:49:28.581180z 0 [note] shutting plugin ' MEMORY ' 2016-05-03t10:49:28.581189z 0 [note] shutting do WN plugin ' MyISAM ' 2016-05-03t10:49:28.581240z 0 [Note] shutting down plugin ' Mrg_myisam ' 2016-05-03t10:49:28.581250z 0 [ Note] shutting down plugin ' Performance_schema ' 2016-05-03t10:49:28.581321z 0 [Note] shutting down plugin ' Innodb_sys_ VIRTUAL ' 2016-05-03t10:49:28.581337z 0 [Note] shutting down plugin ' innodb_sys_datafiles ' 2016-05-03t10:49:28.581341z 0 [Note] Shutting down plugin ' innodb_sys_tablespaces ' 2016-05-03t10:49:28.581345z 0 [Note] shutting down plugin ' Innodb_sys_ Foreign_cols ' 2016-05-03t10:49:28.581349z 0 [Note] shutting down plugin ' innodb_sys_foreign ' 2016-05-03t10  : 49:28.581352z 0 [note] shutting down plugin ' innodb_sys_fields ' 2016-05-03t10:49:28.581356z 0 [note] shutting down plugin ' Innodb_sys_columns ' 2016-05-03t10:49:28.581363z 0 [Note] shutting down plugin ' innodb_sys_indexes ' 2016-05-03t10 : 49:28.581367z 0 [Note] shutting down plugin ' Innodb_sys_tablestatS ' 2016-05-03t10:49:28.581370z 0 [note] shutting down plugin ' innodb_sys_tables ' 2016-05-03t10:49:28.581374z 0 [note] Shutting down plugin ' innodb_ft_index_table ' 2016-05-03t10:49:28.581377z 0 [Note] shutting down plugin ' innodb_ft_index_ CACHE ' 2016-05-03t10:49:28.581381z 0 [note] shutting down plugin ' innodb_ft_config ' 2016-05-03t10:49:28.581411z 0 [note] Shutting down plugin ' innodb_ft_being_deleted ' 2016-05-03t10:49:28.581417z 0 [Note] shutting down plugin ' Innodb_ft_ DELETED ' 2016-05-03t10:49:28.581420z 0 [Note] shutting down plugin ' Innodb_ft_default_stopword ' 2016-05-03t10 : 49:28.581424z 0 [note] shutting down plugin ' innodb_metrics ' 2016-05-03t10:49:28.581428z 0 [note] shutting down plugin ' in Nodb_temp_table_info ' 2016-05-03t10:49:28.581431z 0 [Note] shutting down plugin ' innodb_buffer_pool_stats ' 2016-05-03t10:49:28.581435z 0 [note] shutting down plugin ' INNODB_BUFFER_PAGE_LRU ' 2016-05-03t10:49:28.581438z 0 [note] Shutting down plugin ' innodb_buffer_page ' 2016-05-03t10:49:28.581442z 0 [Note]Shutting down plugin ' Innodb_cmp_per_index_reset ' 2016-05-03t10:49:28.581445z 0 [Note] shutting down plugin ' Innodb_cmp_ Per_index ' 2016-05-03t10:49:28.581449z 0 [Note] shutting down plugin ' Innodb_cmpmem_reset ' 2016-05-03t10:49:28.581452z 0 [note] shutting down plugin ' Innodb_cmpmem ' 2016-05-03t10:49:28.581456z 0 [note] shutting down plugin ' Innodb_cmp_reset ' 2016-05-03t10:49:28.581459z 0 [note] shutting down plugin ' innodb_cmp ' 2016-05-03t10:49:28.581463z 0 [note] shutting down Plugin ' innodb_lock_waits ' 2016-05-03t10:49:28.581466z 0 [Note] shutting down plugin ' innodb_locks ' 2016-05-03t10 : 49:28.581470z 0 [note] shutting down plugin ' Innodb_trx ' 2016-05-03t10:49:28.581473z 0 [note] shutting down plugin ' INNODB ' [Thread 0x7fffb8d04700 (LWP 4112) exited]2016-05-03t10:49:28.581822z 0 [Note] innodb:fts optimize Thread exiting.2016-0 5-03t10:49:28.590938z 0 [Note] innodb:starting shutdown ... [Thread 0x7fff96bfd700 (LWP 4110) exited] [Thread 0x7fff975fe700 (LWP 4109) exited]2016-05-03t10:49:28.691896z 0 [Note] innodb:dumping buffer pool (s) to/usr/local/mysql-5.7.12/data/ib_buffer_pool2016-05-03t10:49:28.692817z 0 [ Note] Innodb:buffer Pool (s) dump completed at 160503 18:49:28[thread 0x7fffb0dbd700 (LWP 4101) Exited][thread 0X7FFF961FC (LWP 4111) exited][thread 0x7fffb17be700 (LWP 4100) exited][thread 0x7fff97fff700 (LWP 4108) Exited][thread 0X7FFFABFF F700 (LWP 4102) exited][thread 0x7fffa8dfa700 (LWP 4107) exited][thread 0x7fffaabfd700 (LWP 4104) Exited][thread 0x7fffa97 fb700 (LWP 4106) exited][thread 0x7fffaa1fc700 (LWP 4105) exited][thread 0x7fffb23e5700 (LWP 4098) Exited][thread 0x7fffab 5fe700 (LWP 4103) exited][thread 0x7fffb37e7700 (lwp 4096) Exited][thread 0x7fffb2de6700 (LWP 4097) Exited][thread 0X7FFFB 87ef700 (LWP 4088) exited][thread 0x7fffb41e8700 (LWP 4095) exited][thread 0x7fffb4be9700 (LWP 4094) Exited][Thread 0x7fff b55ea700 (LWP 4093) exited][thread 0x7fffb69ec700 (LWP 4091) exited][thread 0x7fffb5feb700 (LWP 4092) Exited][Thread 0x7ff fb73ed700 (LWP 4090) exited][Thread 0x7fffb7dee700 (LWP 4089) exited]2016-05-03t10:49:29.967622z 0 [Note] Innodb:shutdown completed; Log sequence number 27390272016-05-03t10:49:29.970363z 0 [Note] innodb:removed temporary tablespace data file: "IBTMP1" 20 16-05-03t10:49:29.970416z 0 [note] shutting down plugin ' Sha256_password ' 2016-05-03t10:49:29.970422z 0 [note] Shutting Down plugin ' Mysql_native_password ' 2016-05-03t10:49:29.970683z 0 [Note] shutting down plugin ' Binlog ' 2016-05-03t10 : 49:29.971711z 0 [Note]/usr/local/mysql-5.7.12/bin/mysqld:shutdown complete[thread 0x7fffeeeec700 (LWP 4087) exited] Program exited normally.  (GDB)

Then even if the program quit is a variety of actions, Hua Hua piece.

And then look at the client that shut down the MySQL service.

You can see that the MySQL service has been completely shut down.

Above is the first time to use GDB to run the mysqld process, can only be considered as a first-involved bar.

MySQL Initial commissioning

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.