CopyCode The Code is as follows: groupadd MySQL // create a MySQL user group
Useradd-G MySQL // create a MySQL account
Tar-zxvf mysql-x.x.xx.tar.gz // decompress MySQL
CD mysql-5.0.45 // enter the decompressed MySQL directory
./Configure-Prefix =/usr/local/MySQL-with-charset = utf8-with-collation = utf8_general_ci-with-extra-charsets = Latin1 // set parameters
Make
Make install // start Installation
CP support-files/my-medium.cnf/etc/My. CNF // copy the my-medium.cnf file to the/etc/directory and rename it to my. CNF
Open the my. CNF file in the editor, find the log-bin = mysql-bin line, and comment it out. Copy codeThe Code is as follows: # log-bin = mysql-bin
CD/usr/local/MySQL // enter the MySQL directory
Bin/mysql_install_db -- user = MySQL
Chown-r root. // Set directory permission attributes
Chown-r MySQL/usr/local/MySQL/var
Chgrp-r MySQL
Bin/mysqld_safe -- user = MySQL & // start MySQL
Open the/etc/rc. Local file in the editor and add/usr/local/MySQL/bin/mysqld_safe-user = MySQL &
Restart and enter mysql. If yes, the startup is successful!
----------- Common MySQL commands --------Copy codeThe Code is as follows: mysql-uroot-P // log on to MySQL on the local machine and use root as the user name
Mysqladmin-uroot-P password 1234 // 1234 is the new password
Create Database mydb; // create a database named mydb
Drop database mydb // delete a database named mydb
Show databases // view the database
Desc func // view the detailed structure of the data table
---------- Key and common database maintenance operations ----Copy codeThe Code is as follows: mysqldump-uroot-p-all-database>/users/venmos/backup. SQL // back up all the databases to the backup. SQL file in the/users/venmos/directory.
Mysqldump-uroot-P mydb>/users/venmos/backup. SQL // back up the backup. SQL file in the/users/venmos/directory of the mydb Database
Use/users/venmos/backup. SQL // import the backup. sqldatabase IN THE/users/venmos/directory
The above is about MySQL installation and simple operation methods, and I hope it will be useful to you.