MySQL Yun Koriyuki---knowledge accumulation

Source: Internet
Author: User

First, MySQL SQL processing business class

1.1. Calculate the Age by birthday

Select Date_format (From_days (To_days (now ())-to_days (' 1788-11-26 '), '%Y ') +0;

1.2, mysqladmin command Change password,-h specifies the IP of the database server

#/usr/mysql/bin/mysqladmin-h 192.168.0.%-uyangsq-p Password
Enter Password:
/usr/mysql/bin/mysqladmin:connect to server at ' 192.168.0.% ' failed
Error: ' Unknown MySQL Server Host ' 192.168.0.% ' (2) '
Check that mysqld are running on 192.168.0.% and that the port is 3306.
You can check the this by doing ' telnet 192.168.0.% 3306 '
#/usr/mysql/bin/mysqladmin-h 192.168.0.3-uyangsq-p Password

Enter Password:
New Password:
Confirm New Password:

1.3. Close multiple servers, you must connect to the specified port number

#/usr/mysql/bin/mysqladmin--port 3306 shutdown

1.4. Add a new field name behind a field in the table

ALTER TABLE stuscore add column ClassID int not null after course;

1.5. Multiple Table association Delete multiple tables
Delete t1,t2 from class T1 inner joins Stuscore T2 on T1.classid=t2.classid and T1.classid in (for each);

1.6. The server maintains many state variables that provide information about the operation. You can reset many state variables to 0 with the flush status statement.

Show status like '%thread% ';

Threads_connected: The number of connections that are currently open.

Threads_created: Creates the number of threads used to process the connection. If the threads_created is larger, you may want to increase the thread_cache_size value. The method of calculating the cache access rate is threads_created/connections.
Threads_running: The number of active (non-sleep) threads.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

MySQL Yun Koriyuki---knowledge accumulation

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.