1 Download and install
Download website:
http://www.mysql.com/
Note that an Oracle account is required to download.
2 starting MySQL
Install the mysql installation directory:
<MYSQL_HOME>
Set as an environment variable and will:
<mysql_home>\bin
Directory join <PATH> environment variables.
To start the command line, enter:
m Ysqld
To start the daemon for MySQL.
3 entering MySQL
m Ysql - u root-p
Password: Enter password
The default root user does not have a password and returns directly to it.
4 Basic Information View
View version:
See which libraries are available:
View Current User:
5 building a library
To establish a database:
Create Database Jeecms;
To delete a database:
Drop database jeecms;
Import data:
SOURCE D:\testdb.sql
6 using the database
Use a library, such as the test Library:
7 Creating a user
To view all users in the current database:
Select User,password,host from Mysql.user;
Such as:
There are several ways to create the user.
1) Create user [email protected] identified by ' 123 ';
Users created this way can only log on on ' localhost ', that is, the server can log on natively, and must use a password.
2) Create user TT identified by ' 123 ';
Users created in this way can log on to a machine of any IP . Note If you log on on a non-server machine, you need to specify the server IPwith the '-h ' parameter, such as:
Mysql-u tt-p123-h 192.168.16.23
If you are logged in directly on the server, you do not need to use a password:
Mysql-u TT
This way, using a password will prompt the login to fail and log in with a password:
This is due to the presence of an empty user, the anonymous account, in the system, as described in 8-2(deleting anonymous accounts).
3) Create user bb;
This way the user can login on any IP machine, and do not need the password, of course, the remote login to specify the '-H ' parameter:
Mysql-u bb-h 192.168.16.23
Mysql-u BB
8 Authorization to the user
1) Authorization
Grant all permissions for all tables in the database jeecms to the user BB:
Grant all privileges in jeecms.* to BB;
2) Delete anonymous account
Then use the user bb login, and see the user under the database, found that there is no jeecms, some operations will be error:
Access denied for user "@ ' localhost ' to database jeecms
The reason is that although the use of BB User Login, but the system still exists in the user name is empty account is anonymous account, resulting in the time of login is BB, but is actually anonymous login, through the error prompt ' @ ' localhost ' can be seen.
Log in with root and use the mysql library:
Use MySQL
To delete an anonymous account:
Delete from user where user= ';
Refresh permissions:
Flush privileges;
This time using the user bb login, you can see the authorized library:
9 Database encoding view and Settings
1) Database Code view
Use the status command:
2) Data encoding modification
Under MySQL 's installation directory <MYSQL_HOME> , back up the original my-default.ini file and rename it to My.ini. Modify the my.ini file to include the following:
[Mysqld]
Character-set-server=utf8
[Client]
Default-character-set=utf8
[MySQL]
Default-character-set=utf8
Restart the MySQL database service and look at the encoding again:
MySQL Basic usage Summary