Sprint Douban (20): mysql basic interview question _ MySQL

Source: Internet
Author: User
Sprint Douban (20): mysql basic interview questions bitsCN.com

1. which tables have mysql permissions?

The MySQL server uses a permission table to control user access to the database. The permission table is stored in the mysql database and initialized by the mysql_install_db script.

These permission tables are user, db, table_priv, columns_priv, and host respectively.

User permission table: records the information of user accounts allowed to connect to the server. the permissions in the table are global.

Database permission table: records the operation permissions of each account on each database.

Table_priv permission table: Records Data Table-level operation permissions.

Columns_priv permission table: records the operation permissions at the data column level.

Host permission table: the database permission table provides more detailed control over Database-level operation permissions on a given host. This permission table is not affected by the GRANT and REVOKE statements.

2. there is an ID auto-incrementing primary key in a table. after 17 records are inserted, the records 15, 16, and 17 are deleted, Mysql is restarted, and another record is inserted, is the ID of this record 18 or 15?

If the table type is MyISAM, it is 18.
Because the MyISAM table records the maximum ID of the auto-incrementing primary key to the data file, the maximum ID of the restart MySQL auto-incrementing Primary Key will not be lost.
If the table type is InnoDB, it is 15.
The InnoDB table only records the maximum ID of the auto-increment primary key to the memory. Therefore, restarting the database or performing the OPTIMIZE operation on the table will lead to the loss of the maximum ID.

Reference: http://blog.csdn.net/chen861201/article/details/7591474

3. What are the features of MYSQL compared with other databases?

MySQL is a small relational database management system. The developer is MySQL AB in Sweden and has now been acquired by Sun, supports FreeBSD, Linux, MAC, Windows, and other operating systems, which are weaker than other large databases such as Oracle, DB2, and SQL Server.

  • It can process large data with tens of millions of records
  • Supports common SQL statement specifications
  • High portability, simple and small installation
  • Good operation efficiency and rich information network support
  • Debugging, management, and simple optimization (compared with other large databases)

4. how can I solve the problem of Chinese garbled characters in the MYSQL database?

Specify the character set during Database security:

After the installation is complete, you can change all the default-character-set = gbk Files in C:/Program Files/MySQL Server 5.0/my. ini.
C:/Program Files/MySQL Server 5.0/data/depot_development/db. optdefault-character-set = gbkdefault-collation = gbk_chinese_ci

When creating a database: specify the character set type:

CREATE DATABASE `database`CHARACTER SET ‘utf8′COLLATE ‘utf8_general_ci’;

The character set is also specified during table creation:

CREATE TABLE `database_user` (`ID` varchar(40) NOT NULL default ”,`UserID` varchar(40) NOT NULL default ”,) ENGINE=InnoDB DEFAULT CHARSET=utf8;

When setting a URL:

jdbc:mysql://localhost:3306/database?useUnicode=true&characterEncoding=UTF-8

5. digress:

If no one believes in you, believe in yourself. If no one appreciates you, then appreciate yourself. If no one wishes you, bless yourself. Touch your own sunshine with your heart, and use love to create your own time and space. When you understand yourself, the world can understand you.

Refer:
Http://www.jobui.com/mianshiti/it/mysql? N = 2

Http://blog.csdn.net/chen861201/article/details/7591474

BitsCN.com

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.