How should the 1.mysql version be chosen?
Since 5.5-5.6 has been optimized for MySQL performance, MySQL 5.5 or 5.6 is generally chosen.
MySQL 5.5.xx-5.6.xx the particularity of the product, so the compilation method is different from the earlier product installation method, the use of cmake or Gmake way to compile and install. that is./cmake; make; Make install, the specific commands and parameters for the production scenario are described in MySQL one-click installation script
One-click installation script Download link http://down.51cto.com/data/2228998
2. Set the initial password for MySQL
MySQL has no initial username and password after installation, so we need to set an initial password for MySQL
mysqladmin -uroot Password [email protected]? --( note that it is mysqladmin, not MySQL)
3. View the database
show databases;
4. Use a library
Use library name;
5. View the current database
Select Database ();
6. Delete a library
Drop database Test (the library name is test);
7. Use a library
Use library name;
8. View the table after entering the library
Show tables;
9. View table Structure
DESC table name;
or select * FROM table name
10. View All Users
Select Host,user from Mysql.user;
11. Delete a user
Drop is generally used to delete a user, but if there are uppercase or special characters in the name, the drop may be problematic and the delete
Drop user '@' localhost ';
Drop user "@" Localhost.localdomain ";
Or
Delete from Mysql.user where host="127.0.0.1";
Flush privileges;
12. Create a new user and empower/create a new administrator
Grant all on * * to ' dailiang ' @ ' percent ' identified by ' [email protected]? ';
Flush privileges;
So the difference between this user and the administrator is that there is no grant permission
Grant all on * * to ' dailiang ' @ ' percent ' identified by ' [email protected]? ' With grant option;
13. Set Query permissions only
Grant SELECT On * * to ' dailiang ' @ ' percent ' identified by ' [email protected]? ';
Flush privileges;
Grant SELECT On * * to ' dailiang ' @ ' 10.0.0.% ' identified by ' [email protected]? ';
Indicates authorization to 10.0.0.x network segment
13. View User Permissions
Show grants for ' Dailiang ' @ '% ';
Or
SELECT * from Mysql.user where user= ' Dailiang ' \g;
14. Revoke of the right to recover
Help revoke;
REVOKE INSERT on * * from ' Jeffrey ' @ ' localhost ';
15. Interactively execute SQL without logging into the database
mysql-uroot [email protected]? - e "Show grants for ' Dailiang ' @ '% ';"
16.mysql User Total 18 permissions
Select
Insert
Update
Delete
Create
Drop
Grant
References
Index
Alter
17. Modify User Password
UPDATE mysql.user SET password=password (' New password ') WHERE user= ' username
Update Mysql.user Set Password=password (' 111 ') where user= ' Dailiang ' and host= '% ';
Flush privileges;
Attention:
1. If you do not add a where condition, all user's password will be changed to ' new password '
After the password modification is completed, the permission refresh operation is required to take effect, flush privileges;
The root user can modify his or her password, or he can modify another user's password
Other users can only modify their own passwords
2.PASSWORD function
mysql> SELECT PASSWORD (' 111 ');
Used to encrypt plaintext of the password, the resulting password is the hash value of the original password.
mysql> SELECT PASSWORD (' 111 ');
+-------------------------------------------+
| PASSWORD (' 111 ') |
+-------------------------------------------+
| *832eb84cb764129d05d498ed9ca7e5ce9b8f83eb |
+-------------------------------------------+
1 row in Set (0.00 sec)
See below: MySQL basic operations 02
This article is from the "Hidden Fishing" blog, please be sure to keep this source http://dailiang.blog.51cto.com/9484865/1827496
MySQL 5.5.39 basic Operations 01