Steps for compiling and installing MySQL from source code

Source: Internet
Author: User
Tags mysql commands most popular database

Mysql is the most popular database system in linux. Today we will introduce the installation and simple operations of mysql!

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.

: # 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 --------

Mysql-uroot-p // log on to the mysql server and use the user name as the root user.
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 ----

Mysqldump-uroot-p-all-database>/Users/venmos/backup. SQL // back up all 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!
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.