mysql有deb包,但是用过一次,感觉不如源码编译安装好,卸载后选择下载源码重新安装。
# Preconfiguration setup shell>groupadd mysql
shell>useradd -r -g mysql mysql
# Beginning of source-build specific instructions shell>tar zxvf mysql-
shell>VERSION
.tar.gzcd mysql-
shell>VERSION
cmake .
shell>make
shell>make install
# End of source-build specific instructions # Postinstallation setup shell>cd /usr/local/mysql
shell>chown -R mysql .
shell>chgrp -R mysql .
shell>scripts/mysql_install_db --user=mysql
shell>chown -R root .
shell>chown -R mysql data
shell>bin/mysqld_safe --user=mysql &
ubuntu下用cmake时可能会报错,按照提示安装一个包后重新cmake。
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
一般是/etc/init.d/目录下。命令如下:
1 cp support-files/mysql.server /etc/init.d/ mysql 2 chmod +x /etc/init.d/ mysql 3 chkconfig --add mysql
第一个命令是复制并重命名,很简单。
第二个命令为mysql服务器文件添加可执行权限。
第三个命令设置系统中所有服务在各运行级别中的启动和关闭状态。
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
1 ./bin/mysqladmin -u root password ' new-password ' 2 ./bin/mysqladmin -u root -h 主机 password ' new-password '
Alternatively you can run:
1
./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:
1
cd . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
1 cd mysql-test ; perl mysql-test-run.pl
New default config file was created as ./my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings