MySQL Tutorial: Database specific operations

Source: Internet
Author: User
Tags mysql mysql tutorial mysql database

1. Connecting to the database server

$./mysql-h Host_name-u User_name-p

-H HOST_NAME (--host=host_name), the connected database hostname, can be omitted if on the local host.

-U user_name (--user=user_name), database username, on UNIX systems, can be omitted if the system's login name is the same as the data user name. In Windows systems, you can give a database user name, such as set User=username, by setting the environment variable user.

-P (--password), provides the database user password, which MySQL will prompt you to enter the password. The password you enter is displayed with an asterisk to ensure security. You can also write the password directly after-P (p and the password can not have spaces), but this is not safe, not recommended.

After the connection is successful, the MySQL database server displays some welcome information. The specified database can then be opened with the Mysql>use database_name command.

The $./mysql-h host_name-u user_name-p database_name command opens the specified database directly.

2. Update user password

Mysql>update user Set PASSWORD=PASSOWRD (' Your passowrd ') where host= '% ';

Refresh permission settings: Mysql>flush privileges;

3. mysql read the order of the configuration file

MY.CNF is a MySQL database configuration file that exists in several places, in the/etc directory, in the data directory, and in the user's home directory. Placed in different positions, the options inside have different scope, the following is the MySQL read the configuration file order and function.

MySQL reads the order of the configuration files:

/ETC/MY.CNF Global Options.

DATADIR/MY.CNF server-specific Options.

Defaults-extra-file the file specified with the--defaults-extra-file option.

~/.MY.CNF user-specific Options.

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.