Four ways to start MySQL

Source: Internet
Author: User

Four ways to start MySQL:

1, Mysqld

Start the MySQL server:./mysqld--defaults-file=/etc/my.cnf--user=root

Client connections:

MySQL--DEFAULTS-FILE=/ETC/MY.CNF

Or

Mysql-s/tmp/mysql.sock

2, Mysqld_safe

Start MySQL server:./mysqld_safe--defaults-file=/etc/my.cnf--user=root &

Client connections:

MySQL--DEFAULTS-FILE=/ETC/MY.CNF

Or

Mysql-s/tm/mysql.sock

3, Mysql.server

Cp-v/usr/local/mysql/support-files/mysql.server/etc/init.d/

Chkconfig--add Mysql.server

Start MySQL server: Service mysql.server {start|stop|restart|reload|force-reload|status}

Client connections: Same as 1, 2

4, Mysqld_multi

mkdir $MYSQL _base/data2

Cat <<-EOF>>/ETC/MY.CNF

[Mysqld_multi]

mysqld=/usr/local/mysql/bin/mysqld_safe

Mysqladmin =/user/local/mysql/bin/mysqladmin

user = Mysqladmin

Password = mysqladmin

[mysqld3306]

Port = 3306

Socket =/tmp/mysql3306.sock

Pid-file=/tmp/mysql3306.pid

Skip-external-locking

Key_buffer_size = 16M

Max_allowed_packet = 1M

Table_open_cache = 64

Sort_buffer_size = 512K

Net_buffer_length = 8K

Read_buffer_size = 256K

Read_rnd_buffer_size = 512K

Myisam_sort_buffer_size = 8M

Basedir=/usr/local/mysql

DataDir=/usr/local/mysql/data

[mysqld3307]

Port = 3307

Socket =/tmp/mysql3307.sock

Pid-file=/tmp/mysql3307.pid

Skip-external-locking

Key_buffer_size = 16M

Max_allowed_packet = 1M

Table_open_cache = 64

Sort_buffer_size = 512K

Net_buffer_length = 8K

Read_buffer_size = 256K

Read_rnd_buffer_size = 512K

Myisam_sort_buffer_size = 8M

Basedir=/usr/local/mysql

DataDir=/usr/local/mysql/data2

Eof

#mysql-S/tmp/mysql3306.sock

Mysql>grant SHUTDOWN on * * to ' mysqladmin ' @ ' localhost ' identified by ' mysqladmin ' with GRANT option;

#mysql-S/tmp/mysql3307.sock

Mysql>grant SHUTDOWN on * * to ' mysqladmin ' @ ' localhost ' identified by ' mysqladmin ' with GRANT option;

Start MySQL server:./mysqld_multi--defaults-file=/etc/my.cnf Start 3306-3307

Shut down MySQL server: mysqladmin shutdown

Refer to <>.1 reference manual >

Http://dev.mysql.com/doc/refman/5.1/zh/database-administration.html#server-side-scripts


Four ways to start MySQL

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.