Set change mysqlroot password, connect mysql,mysql common commands

Source: Internet
Author: User

Set Change mysqlroot password

Enter MySQL database for the first time,
!
The MySQL absolute path can be added to the environment variable,

You can also set the boot load,

Reload environment variable for MySQL to take effect

Re-login to Mysql-uroot
Add a password to MySQL

Re-login verification,

Change Password

Re-login verification, validation successful

Reset password, modify configuration file, skip authorization

Restart the MySQL service, use root user authentication does not require a password

Go in and change the password file
Update user set Password=password (' Aminglinux ') where user= ' root ';
Modify my.conf after exiting
Delete the above skip authorization file
Restart MYSQLD Service
Re-entry to MySQL authentication

Connect to MySQL

Mode 1: Use the TCPIP protocol IP: port, for remote IP, this example is the machine to do the experiment

Mode 2: Using the socket (provided the my.conf is configured with sock), this situation is only suitable for use in this machine.

Method 3: Use the command line to fit with the shell script

MySQL Common commands

Query library show databases;

Switch the library use MySQL;

View the table in the library show tables;

View the fields in the table desc tb_name;

View Build Table statement Show create TABLE tb_name\g;

View the current user Select User ();

View the database currently in use Select Databsase ();

Creating a library Create database db1;

CREATE table use DB1; CREATE TABLE T1 ( id int (4), name char (+)) Engine=innodb DEFAULT Charset=utf8;

Delete tables drop table T1;
View current database version select version ();

View database status Show status;

View each parameter show variables; Pass with show variables like ' max_connect% ';

Modify the parameter set global max_connect_errors=1000; can also be modified in/etc/my.conf

View queue show Processlist; Show full processlist;

Set change mysqlroot password, connect mysql,mysql common commands

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.