Mysql account AccountNameusername and hostname_MySQL

Source: Internet
Author: User
Mysql Account AccountName -- username and hostname mysql Account Name

The following is an explanation of mysql5.6 Reference Manual:

MySQL account names consist of a user name and a host name. This enables creation of accounts for users with the same name who can connect from different hosts.

That is to say, the mysql account is composed of a user name and a host name to distinguish the same user name on different hosts.


Write account names using the following rules:

  • Syntax for account names is 'user _ name' @ 'host _ name '.

  • An account name consisting only of a user name is equivalent to 'user _ name' @ '%'. For example, 'me' is equivalent to 'me' @ '% '.

  • The user name and host name need not be quoted (reference) if they are legal (valid) as unquoted identifiers. quotes are necessary to specify a user_name string containing special characters (such as "-"), or a host_name string containing special characters or wildcard (wildcard) characters (such as "% "); for example, 'Test-user' @ '%. com '.

  • Quote user names and host names as identifiers or as strings, using either backticks (""), single quotation marks ("), or double quotation marks ("). (use single or double quotation marks)

  • The user name and host name parts, if quoted, must be quoted separately. that is, write 'me' @ 'localhost', not 'Me @ localhost'; the latter is interpreted as 'Me @ localhost' @ '% '.

  • A reference to the CURRENT_USER or CURRENT_USER () function is equivalent to specifying the current client's user name and host name literally.


See: http://dev.mysql.com/doc/refman/5.6/en/account-names.html

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.