MySQL Installation documentation

Source: Internet
Author: User

sudo apt-get install CMake

sudo apt-get install Libncurses5-dev

sudo apt-get install Bison

sudo groupadd MySQL

sudo useradd-s/sbin/nologin-m-g MySQL MySQL


Tar zxvf mysql-5.5.28.tar.gz

CD mysql-5.5.28/

Cmake-dcmake_install_prefix=/data/mysql/mysql \

-dmysql_unix_addr=/data/mysql/log/mysql.sock \

-ddefault_charset=utf8 \

-DDEFAULT_COLLATION=UTF8_GENERAL_CI \

-DWITH_EXTRA_CHARSETS:STRING=UTF8,GBK \

-dwith_myisam_storage_engine=1 \

-dwith_innobase_storage_engine=1 \

-dwith_memory_storage_engine=1 \

-dwith_readline=1 \

-denabled_local_infile=1 \

-dmysql_datadir=/data/mysql/mysqldata \

-dmysql_tcp_port=3306 \

-dmysql_user=mysql

Make

Make install

CP SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF

Sed '/skip-external-locking/i\datadir =/data/mysql/mysqldata '-i/etc/my.cnf

if [$installinnodb = "Y"]; Then

Sed-i ' s: #innodb: Innodb:g '/etc/my.cnf

Sed-i ' S:/usr/local/mysql/data:/data/mysql/mysqldata:g '/etc/my.cnf

Else

Sed '/skip-external-locking/i\default-storage-engine=myisam\nloose-skip-innodb '-i/etc/my.cnf

Fi


/data/mysql/mysql/scripts/mysql_install_db--defaults-file=/etc/my.cnf--basedir=/data/mysql/mysql--datadir=/ Data/mysql/mysqldata--user=mysql

Chown-r Mysql/data/mysql/mysqldata

Chgrp-r Mysql/data/mysql/mysql.

CP Support-files/mysql.server/etc/init.d/mysql

chmod 755/etc/init.d/mysql


Cat >/etc/ld.so.conf.d/mysql.conf<<eof

/data/mysql/mysql/lib

/usr/local/lib

Eof

Ldconfig


Ln-s/data/mysql/mysql/usr/lib/mysql

Ln-s/data/mysql/mysql/include/mysql/usr/include/mysql

If [-D "/proc/vz"];then

Ulimit-s Unlimited

Fi

/etc/init.d/mysql start


Ln-s/data/mysql/mysql/bin/mysql/usr/bin/mysql

Ln-s/data/mysql/mysql/bin/mysqldump/usr/bin/mysqldump

Ln-s/data/mysql/mysql/bin/myisamchk/usr/bin/myisamchk

Ln-s/data/mysql/mysql/bin/mysqld_safe/usr/bin/mysqld_safe


/data/mysql/mysql/bin/mysqladmin-u Root Password $mysqlrootpwd


Cat >/tmp/mysql_sec_script<<eof

Use MySQL;

Update user set Password=password (' $mysqlrootpwd ') where user= ' root ';

Delete from user where not (user= ' root ');

Delete from user where user= ' root ' and password= ';

drop database test;

DROP USER ' @ '% ';

Flush privileges;

Eof


MySQL Installation documentation

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.