MySQL Learning Note (2-initialization)

Source: Internet
Author: User
Tags mysql client

Initialization

(1) Set password for root user (three ways):

SET PASSWORD for ' username ' @ ' host ' = PASSWORD (' Your_password ');

Update Mysql.user set Password=password (' Your_password ') where user= ' username ' and host= ' hostname or IP '

mysqladmin-uusernmae-hhostname_or_ip-p password ' new_password '


(2) Delete anonymous users:

DROP USER ' @ ' HOSTNAME '

The above steps can run the command; mysql_secure_installation

(3) It is recommended to turn off the host name inverse function;

Vim/etc/my.cnf

Skip-name-resolve


Find path:

/ETC/MY.CNF--/ETC/MYSQL/MY.CNF-$MYSQL _home/my.cnf-----default-extra-file=/path/to/somedir/my.cnf-- > ~/.my.cnf

The more the latter, the last effective


--defaults-extra-file=#: Additional read configuration file;

--defaults-file=#: Read only the configuration file specified here


Common options for MySQL client programs:

-u,-h,-p,--Database,--Port

Import Batch script: Log in to MySQL source/path/script.sql or MySQL </path/script.sql

MySQL single statement insert: MYSQL-E ' SQL statement '


This article is from the "Wang Liming" blog, make sure to keep this source http://afterdawn.blog.51cto.com/7503144/1925772

MySQL Learning Note (2-initialization)

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.