General management of MySQL Database System

Source: Internet
Author: User
Tags mysql update mysql command line
When running the database system, MySQL is quite simple to use, and little work is required to install and use MySQL. However, no matter what level of expert you are, MySQL installation programs cannot run automatically. Someone must monitor it to ensure it runs smoothly and effectively, and sometimes know what to do when the problem occurs. MySQL manages

When running the database system, MySQL is quite simple to use, and little work is required to install and use MySQL. However, no matter what level of expert you are, MySQL installation programs cannot run automatically. Someone must monitor it to ensure it runs smoothly and effectively, and sometimes know what to do when the problem occurs. MySQL manages

When running the database system, MySQL is quite simple to use, and little work is required to install and use MySQL. However, no matter what level of expert you are, MySQL installation programs cannot run automatically. Someone must monitor it to ensure it runs smoothly and effectively, and sometimes know what to do when the problem occurs. The management of MySQL has its own unique requirements. This article will help you familiarize yourself with this content.

Overview of management responsibilities

The MySQL database system consists of several parts. You should be familiar with the content of these components and the purpose of each part. This requires you to understand the features of the management system and the available tools to help you manage. If you take the time to understand the content to be supervised, your work will become very easy. To this end, you should familiarize yourself with the following aspects of MySQL:

MySQL server. The mysql Server performs all database and table operations. Safe_mysqld is a related program used to start the server, monitor the server, and restart the server.

MySQL client and utility. There are several MySQL programs that can help you communicate with the server and perform management tasks. The most important ones are:

Mysql, an interactive program that allows you to publish SQL statements to the server and view the results.

Mysqladmin is a management program that allows you to close the server and create or delete databases. If the server is not running properly, you can use mysqladmin to check the server status.

Isamchk and myisamchk, which help you analyze and optimize tables and perform crash recovery when tables are corrupted.

Mysqldump is a tool used to back up a database or copy a database to another server.

The language of the server, SQL. Some management responsibilities can only be completed using the command line utility of mysqladmin. However, it is better if you can use your own language to talk to the server. As a simple example, you may need to find out why user privileges do not work as expected. No alternatives can participate and communicate directly with the server. You can use the mysql client program to publish SQL queries that can check the authorization table. If you have not introduced the GRANT statement in your MySQL version, you need to use mysql to first set permissions for each user.

If you do not know anything about SQL, you must at least have a basic understanding of SQL. Lack of familiarity with SQL will only confuse you, and the time spent learning SQL will be doubled. It takes some time to master SQL, but it takes a short time to master basic skills. For more information about SQL and mysql command line clients, see "MySQL and SQL Introduction" in Chapter 1st"

MySQL data directory. The data directory is where the server stores its database and status files. It is very important to understand the structure and content of the data directory. You can know how the server uses a file system to represent databases and tables, and the storage location and content of files such as logs. You should also be aware of the option of managing disk space allocation in the file system. You can adjust the option when the file system in which the data directory is placed is too full.

General Management

General management mainly refers to the operations on mysqld, MySQL server, and access server provided to users. The following tasks are most important when performing this role:

Server startup and shutdown. You should be able to manually start and stop the server from the command line, and know how to enable and disable the server automatically when the system starts and closes. If the server crashes or cannot be started properly, it is important to know how to re-run the server.

User account maintenance. Understand the differences between MySQL users and UNIX or Windows users. You should know how to create a MySQL user account by specifying which users can connect to the server and where to connect. We should also recommend appropriate connection parameters for new users so that they can successfully connect to the server. It is not the work of users to figure out how to create accounts.

Log File Maintenance. You should understand the types of log files that can be maintained, and how to maintain the log files at and when. Log loop and termination are necessary to prevent logs from filling the file system.

Back up and copy databases. Database Backup is crucial to server system crash. You should be able to restore the database to the state of crash to minimize data loss. Note that database backup is different from conventional system backup. For example, you can use a UNIX dump program. Files that correspond to database tables change with server activity when system backup occurs, so restoring those files will make your tables inconsistent internally. The mysqldump program will generate backup files that are more useful for database restoration and allow you to create backups without shutting down the server.

If you decide to run the database on a faster host or want to copy the database, you need to copy its content to another machine. If necessary, you should understand the process of performing this operation. Database Files depend on the system. Therefore, you cannot copy only these files.

Server optimization. The user wants the server to run in the optimal state. The simplest way to improve server performance is to buy more memory or make the disk faster. However, this straightforward technique does not replace the understanding of server work. You should understand the parameters used to optimize server operations and how to apply these parameters in your environment. In some websites, most queries are retrieved. In other websites, insert and update operations take advantage. You can select which parameters will be affected by the Site query.

Multiple servers. It is useful to run multiple servers in some environments. If you retain the current finished installation program in the appropriate location, or provide better confidentiality for different user groups (the latter is especially relevant to the ISP), you can test the new MySQL version. In these cases, you should know how to create multiple simultaneous installations.

MySQL update. Because New MySQL versions are frequently used, you should know how to keep up with these versions to take advantage of troubleshooting and new features. You need to understand the reasons for not upgrading the version, and know how to select between the stable version and the developer version.

Security

When running the MySQL installer, it is important to ensure the security of the data stored by the user. The MySQL Administrator has the responsibility to control access to data directories and servers, and should understand the following issues:

Security of the file system. UNIX machines may make several user accounts become the host account, and these accounts have no management responsibilities related to MySQL. Make sure that these accounts do not have access to the data directory. This prevents them from damaging file system-level data by copying database tables or moving database tables, or by reading log files containing sensitive information. You should know how to create a UNIX User Account of the MySQL server, how to create a data directory owned by the user, and how to start the server to run with the user's permissions.

Server Security. You must understand how the MySQL security system works so that you can grant appropriate permissions when creating user accounts. Users connected to the server through the network can only do what they should do. Do not grant the superuser access permission to anonymous users because of an incorrect understanding of the security system.

Database Repair and Maintenance

All MySQL administrators want to avoid dealing with corrupted or destroyed database tables. But desire cannot replace reality. The following steps help you reduce risks when a problem occurs and learn how to handle the problem:

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.