Linux centosvmware MySQL Common operation settings change root password, connect MySQL, mysql common command

Source: Internet
Author: User

First, set the change root password

Start MySQL

/usr/local/mysql/bin/mysql-uroot

Error

VI my.cnf inside the socket path changed to/tmp/mysql.sock, and made a soft link: ln-s/tmp/mysql.sock/var/lib/mysql/mysql.sock after normal

Change environment variable path, add MySQL absolute path

Mysqladmin-uroot password ' mimA123 '

mysql-uroot-pmima123 Use the-P command with a password to enter the

Password reset

vi/etc/my.cnf//Increase Skip-grant

Restart MySQL service/etc/init.d/mysqld restart

Mysql-uroot

Use MySQL;

The password is an encrypted string

Update user set Password=password (' mimA123 ') where user= ' root ';

Second, connect MySQL

Mysql-uroot-pmima123

mysql-uroot-pmima123-h127.0.0.1-p3306

Mysql-uroot-pmima123-s/tmp/mysql.sock

Mysql-uroot-pmima123-e "Show Databases"

Third, 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 user;

View Build Table statement Show create TABLE user\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 (40));

View current database version select version ();

View database status Show status;

View each parameter show variables; Show variables like ' max_connect% ';

Modify parameter set global max_connect_errors=1000;

View queue show Processlist; Show full processlist;

Linux centosvmware MySQL Common operation settings change root password, connect MySQL, mysql common command

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.