将MySQL作为系统服务启动:
在执行完上面的安装过程时,命令行会提示如下信息:
tsrr@tsrr-server:/usr/local/mysql$ sudo scripts/mysql_install_db
--user=mysql --basedir=/usr/local/mysql
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following
commands:
/usr/local/mysql/bin/mysqladmin -u root password
'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h tsrr-server password
'new-password'
Alternatively you can run:
/usr/local/mysql/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe
&
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl
Please report any problems with the
/usr/local/mysql/scripts/mysqlbug script!
The latest information about MySQL is available at
http://www.mysql.com/
Support MySQL by buying support/licenses from
http://shop.mysql.com/
根据上面的说明,我们将复制到,命令如下:
代码:
:$ sudo cp
support-files/mysql.server
/etc/init.d/mysql 启动mysql服务
:$ sudo /etc/init.d/mysql start
重启mysql服务
:$ sudo /etc/init.d/mysql restart
关闭mysql服务
:$ sudo /etc/init.d/mysql stop