To install MySQL from the source code

Source: Internet
Author: User
Tags create database most popular database backup

MySQL is the Linux platform's most popular database system, today is the introduction of MySQL installation and simple operation Method!

groupadd mysql //建立mysql用户组
useradd -g mysql mysql //建立mysql帐户
tar -zxvf mysql-x.x.xx.tar.gz //解压缩mysql
cd mysql-5.0.45 //进入解压好的mysql目录
./configure –prefix=/usr/local/mysql –with-charset=utf8 –with-collation=utf8_general_ci –with-extra-charsets=latin1 //设置参数
make
make install //开始安装
cp support-files/my-medium.cnf /etc/my.cnf //拷贝my-medium.cnf文件到/etc/目录下并重命名为my.cnf

Open the my.cnf file with the editor, find the Log-bin=mysql-bin line, and comment it out

: #log-bin=mysql-bin

cd /usr/local/mysql  //进入mysql目录
bin/mysql_install_db --user=mysql
chown -R root . //设置目录权限属性
chown -R mysql /usr/local/mysql/var
chgrp -R mysql
bin/mysqld_safe --user=mysql & //启动mysql

Open the/etc/rc.local file with the editor, plus/usr/local/mysql/bin/mysqld_safe–user=mysql & in front of exit 0

Reboot, enter MySQL, if you can enter the start success!

——————————-MySQL Common commands ————————

mysql -uroot -p //登陆本机mysql、root为用户名
mysqladmin -uroot -p password 1234 //1234为新密码
create database mydb;  //新建一个名为mydb的数据库
drop database mydb //删除一个名为mydb的数据库
show databases //查看数据库
desc func  //查看数据表的详细结构

————————— – Critical, common database maintenance operations ————

mysqldump -uroot -p -all -database>/Users/venmos/backup.sql //备份全部数据库到/Users/venmos/目录下的backup.sql文件
mysqldump -uroot -p mydb>/Users/venmos/backup.sql //备份mydb数据库到/Users/venmos/目录下的backup.sql文件
use /Users/venmos/backup.sql //导入/Users/venmos/目录的backup.sql数据库

The above is about the installation of MySQL and simple operation method, hope for everyone useful!

Related Article

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.