Ubuntu 12.04 下安装MySQL 5.5.25
时间:2014-11-02 12:10 来源:linux.it.net.cn 作者:it
MySQL官方的安装文档请参考《Installing MySQL from Generic Binaries on Other Unix-Like Systems》和《Unix Postinstallation Procedures》。
Ubuntu版本:12.04 LTS
MySQL版本:MySQL Community Server 5.5.25
安装目录:/usr/local/development/mysql-5.5.25
1. 打开网址http://www.mysql.com/downloads/mysql/,下载相应的MySQL版本(本文选择的是64位tar压缩版本)。
2. 将下载的文件解压缩到/usr/local/development/mysql-5.5.25目录。
3. 创建mysql用户和组。注意,我们创建的mysql用户只是为了控制文件所有权的目的,因此我们执行useradd的时候使用了-r参数让它不需要登陆。
sudo groupadd mysql
sudo useradd -r -g mysql mysql
4. 改变/usr/local/development/mysql-5.5.25目录的所有者为mysql。
sudo chown -R mysql:mysql /usr/local/development/mysql-5.5.25/
5. 使用mysql_install_db初始化授权表。此操作只是在MySQL初次安装时才需要执行,如果是已存在的安装,则可以跳过此步骤,否则会覆盖先前的授权信息。
sudo scripts/mysql_install_db --user=mysql
6. 发现mysql_install_db执行有错误。看错误提示,原来是因为缺少共享库libaio1。
7. 安装共享库libaio1。
8. 再次执行mysql_install_db,这次执行成功。
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:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h amonest-Satellite-C600 password 'new-password'
Alternatively you can run:
./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 . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl
Please report any problems with the ./bin/mysqlbug script!
9. 配置mysql服务,然后启动。
cd /etc/init.d
sudo ln -s /usr/local/development/mysql-5.5.25/support-files/mysql.server
sudo /etc/init.d/mysql.server start
10. 启动mysql服务时报错了,原来是没有/usr/local/mysql目录。
11. 创建符号链接/usr/local/mysql到/usr/local/development/mysql-5.5.25。
cd /usr/local
sudo ln -s /usr/local/development/mysql-5.5.25 mysql
sudo chown -R mysql:mysql mysql
12. 再次启动mysql服务试试看,OK,这次成功了。
13. 使用mysqladmin version命令检查一下是否可以连接mysql。
14. 最后我们配置一下每次开机时自动启动mysql服务。
sudo update-rc.d mysql.server defaults
(责任编辑:IT)
MySQL官方的安装文档请参考《Installing MySQL from Generic Binaries on Other Unix-Like Systems》和《Unix Postinstallation Procedures》。
Ubuntu版本:12.04 LTS MySQL版本:MySQL Community Server 5.5.25 安装目录:/usr/local/development/mysql-5.5.25
1. 打开网址http://www.mysql.com/downloads/mysql/,下载相应的MySQL版本(本文选择的是64位tar压缩版本)。
2. 将下载的文件解压缩到/usr/local/development/mysql-5.5.25目录。
3. 创建mysql用户和组。注意,我们创建的mysql用户只是为了控制文件所有权的目的,因此我们执行useradd的时候使用了-r参数让它不需要登陆。 sudo groupadd mysql sudo useradd -r -g mysql mysql 4. 改变/usr/local/development/mysql-5.5.25目录的所有者为mysql。 sudo chown -R mysql:mysql /usr/local/development/mysql-5.5.25/ 5. 使用mysql_install_db初始化授权表。此操作只是在MySQL初次安装时才需要执行,如果是已存在的安装,则可以跳过此步骤,否则会覆盖先前的授权信息。 sudo scripts/mysql_install_db --user=mysql 6. 发现mysql_install_db执行有错误。看错误提示,原来是因为缺少共享库libaio1。
7. 安装共享库libaio1。
8. 再次执行mysql_install_db,这次执行成功。 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: ./bin/mysqladmin -u root password 'new-password' ./bin/mysqladmin -u root -h amonest-Satellite-C600 password 'new-password' Alternatively you can run: ./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 . ; ./bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd ./mysql-test ; perl mysql-test-run.pl Please report any problems with the ./bin/mysqlbug script! 9. 配置mysql服务,然后启动。 cd /etc/init.d sudo ln -s /usr/local/development/mysql-5.5.25/support-files/mysql.server sudo /etc/init.d/mysql.server start 10. 启动mysql服务时报错了,原来是没有/usr/local/mysql目录。
11. 创建符号链接/usr/local/mysql到/usr/local/development/mysql-5.5.25。 cd /usr/local sudo ln -s /usr/local/development/mysql-5.5.25 mysql sudo chown -R mysql:mysql mysql 12. 再次启动mysql服务试试看,OK,这次成功了。
13. 使用mysqladmin version命令检查一下是否可以连接mysql。
14. 最后我们配置一下每次开机时自动启动mysql服务。 sudo update-rc.d mysql.server defaults (责任编辑:IT) |