Mysql-1, mysql1045
I have been using mysql for more than a year, but it is rarely used at ordinary times. I only want to install and deploy mysql. Recently I have been studying O & M development and need to use databases. So I have bought a mysql copy, give yourself two weeks to finish learning this book,
Writing this series of blogs is to record the learning process, the pitfalls that have passed, the barriers that have crossed, and make a record.
This is the link to this book.
Http://www.forta.com/books/0672327120/
To learn the examples, you need a group of tables that are filled with data. Everything you need to obtain and run can be found at this link. This webpage contains two SQL scripts that can be downloaded,
Create. SQL contains the six created database tables.
Populate. SQL contains the INSERT statements used to fill these tables.
To do this, you must first install mysql and create user authorization.
Install mysql in windows
Mysql http://dev.mysql.com/downloads/mysql/
After the download is complete, click Next to complete the installation. How to configure mysql Environment Variables
In win7:
Right-click computer ---> select Advanced System settings ---> select environment variable ---> User volume of Administrator, find Path ---> click Edit ---> Add the Path to install mysql at the end of the variable value, this is the path of my installation (C: \ Program Files \ MySQL Server 5.7 \ bin ;)
Open powershell and enter mysql to log on successfully.
Configure password:
Mysqladmin-uroot password 123456
Create and authorize a user
[Root @ VM_27_98_centos ~] # Mysql-uroot-p Enter password: Welcome to the MySQL monitor. commands end with; or \ g. your MySQL connection id is 4 Server version: 5.1.73 Source distributionCopyright (c) 2000,201 3, Oracle and/or its affiliates. all rights reserved. oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. other names may be trademarks of their respectiveowners. type 'help; 'or' \ H' for help. type '\ C' to clear the current input statement.
Create a user and authorize mysql> grant all privileges on *. * to whh @ '%' identified by '000000'; Query OK, 0 rows affected (123456 sec)
Grant |
All privileges |
On *.* |
To username @ '%' |
Identiidentified ied by 'Password' |
Authorization command |
Corresponding Permissions |
Target: database and table |
User Name and client host |
User Password |
View user authorization
Mysql> show grants for whh @ '%'; + ------------------------------------------ + | Grants for whh @ % | + grants + | grant all privileges on *. * TO 'whh' @ '%' | + -------------------------------------------- + 1 row in set (0.00 sec)
Cancel authorization
Mysql> revoke all on *. * from whh @ '% ';
Query OK, 0 rows affected (0.00 sec)
Mysql> show grants for 'whh' @ '% ';
+ --------------------------------- +
| Grants for whh @ % |
+ --------------------------------- +
| Grant usage on *. * TO 'whh' @ '%' |
+ --------------------------------- +
1 row in set (0.00 sec)
Delete a user
Mysql> drop user 'whh' @ '% ';
Query OK, 0 rows affected (0.01 sec)
Import tables and data in this book
mysql> use study;
mysql> source C:\MySQL\create.sql
mysql> source C:\MySQL\populate.sql
Now that the basic configuration and preparation work are ready, we will officially start learning mysql tomorrow.