Use MySQL for the first time-server installation and connectivity.

Source: Internet
Author: User
Tags insert modify connect mysql mysql host mysql database
mysql| Server installation using the default installation is also possible, and can be customized to install, are simpler. After installation for easy to use, it is best to set up environment variables: path=%path%; your MySQL installation path \ bin is ok.
First to connect to the MySQL server: mysql-uroot-p//sql User default does not have a password will appear prompt: Mysql>_

Then select the database used: use MySQL//mysql for a system's database name, and test, but an empty database.

Then you can do the appropriate operation:mysql> input the appropriate operation instructions, and then add \g can be executed. Example:mysql>select * from user/g carriage return

The following is a excerpt from the internet about modifying the password to create a new user operation.

Second, modify the password. Format: Mysqladmin-u username-P Old password password new password 1, example 1: Add a password to root ab12. First in DOS into the directory mysqlbin, and then type the following command Mysqladmin-uroot-password AB12 Note: Because the beginning of the root does not have a password, so-p old password one can be omitted.    2, Example 2: Then the root password changed to djg345. MYSQLADMIN-UROOT-PAB12 Password djg345

Third, add new users. (Note: Unlike the above, the following is followed by a semicolon as a command terminator in the case of a command in a MySQL environment): Grant Select on database. * To username @ Login host identified by "password" Example 1, Add a user test1 password to ABC, so that he can log on any host, and all databases have query, insert, modify, delete permissions. First you connect the root user to MySQL, and then type the following command: Grant Select,insert,update,delete on *.* to test1@ "%" identified by "ABC"; But for example 1 the increased user is very dangerous and you want someone who knows Test1 's password so that he can log on to your MySQL database on any computer on the Internet and can do whatever it wants with your data, as shown in Example 2. Example 2, add a user test2 password for ABC, so that he can only log on the localhost, and can query the database mydb, insert, modify, delete operations (localhost refers to the local host, that is, the MySQL database of the host),   This allows the user to use a password that knows test2, and he cannot access the database directly from the Internet, only through a Web page on the MySQL host.   Grant Select,insert,update,delete on mydb.* to Test2@localhost identified by "ABC";   If you do not want to test2 the password, you can make another command to eliminate the password. Grant Select,insert,update,delete on mydb.* to Test2@localhost identified by "";


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.