Installation and Application of MySQL platform
Mysql database installation application
1:MySQL is a multiuser, multithreaded service.
Advantages:
High performance
Highly reliable and easy to use
The 3306 port matching file that uses TCP by default is / etc/my.cnf
The compilation and installation process of 2:MySQL:
Use rpm-Q mysql-server mysql to check whether MySQL packets are installed, and if uninstall is recommended, otherwise conflicts will occur later
Install the ncurses-devel package to resolve dependencies
Rpm-ivh / media/Packages/ncurses-devel-5.7-3.20090208.e16.x68.rpm package
3:MySQL5.5 needs to be compiled and installed by cmake, so install the cmakepackage first
4: in order to strengthen the authority control of the database, create a special running user who cannot log in directly to the system.
5: extract the MySQl package
-DCMAKE_INSTALL_PREFIX: set the installation directory path
-DSYSCONFDIR: specify initialization parameters
-DDEFAULT_CHARSET: specifies the default character set encoding utf8
-DDEFAULT_COLLATION: specifies that character set verification rules are used by default
-DWITH_EXTRA_CHARSETS: specify additional character set encodings
Because the content of the database is huge, it is necessary to configure the content of the database.
6: other adjustments after installation
(1) set permissions on the database directory
(2) to establish configuration files, my-medium.cnf medium-sized enterprise database is generally selected.
(3) initialize the database: in order to use the database, you should execute the initialization script mysql_install_db as the MySQL user to specify the data storage directory.
(4) set environment variables and import them as global variables.
7: add system services, which can then be set using service:
Verify the effect:
8: access to the database, the database is a typical cUnix s architecture application.
Log in to the database:
9: execute the MySQL operation statement to view the database libraries and tables
10: view the structure of the table
11: create additional tables and libraries using the creare command
12: the drop command is used to delete libraries and tables:
13: insert the data into the table, where we use the users table in the tty library
14: query data records and use the select command to find: find information about zhangsan users:
15: maintain the MySQL database
Users need to be authorized: the permissions are: select,insert,update,all. Here we will test with all the permissions of all:
16. Database backup and recovery: first export the contents of the database, and then import it into the database for recovery:
Use the command mysqldump to export the database
Then restore the database MySQL library: first delete the MySQL library and then restore:
Start recovery: verify the effect
17: root, a MySQL database user, can set a password in two ways:
(1) use mysqladmin-u root-p password 'password'
(2) use update command to modify
Update MySQL.user set password=PASSWORD ('password') WHERE user='root'
Then refresh the authorization flush privileges
We use the first way to set the password:
The second way to set the password: