The MySQL database
The profile
MySQL database: MySQL database: MySQL; MySQL database: MySQL; MySQL database: MySQL;Copy the code
MySQL database
1. Overview of database
<1> Database: Database
- An organized, shareable collection of data stored in a computer for a long time.
- A repository for storing data. (documents)
<2> Database Management System: Database Management System
- Software to manipulate and manage databases. (software)
<3> Type of database
- Relational database: Stores data in the form of two-dimensional tables.
- Non-relational database: NoSQL———Not only SQL
- Redis: key-value pair storage, k-V storage
- MongoDB: Document storage, storing data in the form of documents, Json/XML
- HBase: column storage, Hadoop Database
<4> Mainstream relational databases
- Oracle: Oracle corporation
- Microsoft used to:
- Simple, friendly interface, strong interaction and operability
- Poor openness and low performance
- IBM DB2:
- Scalability is strong, suitable for all mainstream platforms
- charge
- MySQL: MySQL AB
2. MySQL Database Overview
<1> MySQL database
- MySQL is a relational database management system developed by MySQL AB, a Swedish company. It is currently a product of Oracle.
< 2 > version
- Community Edition: Free (individual, organization, business)
- Enterprise edition: non-profit copyright, will charge a service fee
< 3 > characteristics
- Open source, free relational database management system
- Short, fast, low cost of ownership
- Is part of LAMP’s popular website architecture (Linux+Apache+MySQL+ PHP)
- Widely used in Internet companies (small and medium-sized websites)
Install the MySQL database
<1> Installation mode
- ZIP installation using compressed packages
- MSI installation: Install Windows Installer in Microsoft format
<2> Note: It has been installed before, please uninstall it and install it again
- Disabling the MySQL service
- Right click on your computer and click Manage to find mysql service shutdown
- Uninstalling MySQL
- Control panel —- program —- uninstall program —- right-click uninstall MySQLxxx file
- Deleting Residual Files
- Original installation position
- Delete c: \ ProgramData \ MySQL
- Delete residual file configuration parameters
- Open the registry (win+R—-regedit—-xxxMACHINE—-SYSTEM—-ControlSetxxx port Services EventLog—-Application server delete MySQLxxx)
< 3 > installation
- MSI installation (easier to operate and configure)
- Note: for character set selection, utF8 is recommended
3. Use MySQL software
<1> Start the service
- Net start Mysql starts the service
- Net stop Stop the mysql service
<2> Login database
- Format: mysql-parameter
- Parameters:
- -u username
- -p password
- -p port number
- -h Server address of the database (remote link database)
- — prompt sets the prompt
- Such as:
- mysql -uroot -proot
- Mysql -uroot -proot-p3306-h127.0.0.1
- Mysql – uroot – proot P3306 – h123.231.11.35 (ali cloud server: Shanghai | Beijing)
- Mysql -uroot -p press Enter
- Password (password not visible)
- Enter the password using MySQL Command Line Clinet
<3> Exit the database
- ctrl+c
- exit
- \q
- quit
<4> Change the password
- The first way to change your password is to use this method when you forget your M password
-
Stop MySQL service
-
Type mysqld –skip-grant-tables under DOS
-
Open a new DOS login mysql database (no password required)
-
Change password:
- Use mysql Select the database whose name is mysql
- Update user set password=password(‘ password ‘) where user=’root’;
-
Close the DOS window and end the mysqld process
-
Restart the MySQL service and log in with the new password
-
update user set password=password(“root”) where user=”root”;
- The second way to change the password is to change the password when you have not forgotten it. It is recommended to use this method because it is simple.
- Mysqladmin -u username -p password new password
- Or mysqladmin -u username -p password password New password
<5> Modify MySQL prompt
- Prompt prompt
- Mysql -uroot -proot –prompt
- For example: mysql-uroot-proot –prompt nihao
<6> Identify the version number
- select version();