13.1 Settings Change root password 13.2 Connect MySQL 13.3 mysql common command

Source: Internet
Author: User

Check that the MySQL service has started and has started

This command is not in the environment path.

[Email protected] ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

[Email protected] ~]# export path= $PATH:/usr/local/mysql/bin/Add the command to the path, but it does not take effect permanently. To be permanently active, put the statement under/etc/profile

[[email protected] ~]# Source/etc/profile effective

-U specify user,-p specify password

[[email protected] ~]# mysqladmin-uroot password ' aminglinux.1 ' Set root password
Warning:using a password on the command line interface can is insecure.
[[email protected] ~]# mysql-uroot no password-P will error
ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)
[Email protected] ~]# mysql-uroot-p
Enter Password:
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 5
Server version:5.6.36 MySQL Community Server (GPL)

Copyright (c), Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

Mysql>

So how to change the password (under the condition of the known root password)

What to do if you forget the root password

1. Change configuration file, add skip-grant, ignore authorization

2. Restart MySQL

You can log in directly.

3 Changing the user table, updating the password

4. Change the previous configuration my.cnf back and restart the service

The following-p is used to specify the bound port of the remote host MySQL, by default 3306,-h is used to specify the IP of the remote host

Using the socket to connect MySQL, not TCP/IP, is only suitable for use in native

Execute SQL statement when connecting

View the fields in the table

Mysql> Show CREATE TABLE user\g; See how the watch was built.

View the database that you are using

Create a database DB1

View current version

View queues

13.1 Settings Change root password 13.2 Connect MySQL 13.3 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.