MySQL 5.5源码安装(二)

2014-11-24 15:49:44 · 作者: · 浏览: 2
psupport-files/mysql.server /etc/init.d/mysqld
[root@serv01 mysql-5.5.29]# chmod a+x/etc/init.d/mysqld
[root@serv01 mysql-5.5.29]# ls /usr/local/mysql/data/
mysql test
第十步,改变mysql目录的拥有者和所属组,并修改my.cnf文件,添加data目录
[root@serv01 mysql-5.5.29]# chown mysql.mysql/usr/local/mysql/ -R
[root@serv01 mysql-5.5.29]# vim /etc/my.cnf
[root@serv01 mysql-5.5.29]# cat /etc/my.cnf |grep datadir
datadir =/usr/local/mysql/data
第十一步,修改mysql_install_db的权限,使其可执行,并进行初始化操作
[root@serv01 mysql-5.5.29]# chmod a+xscripts/mysql_install_db
[root@serv01 mysql-5.5.29]#./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/--basedir=/usr/local/mysql/
WARNING: The host 'serv01.host.com' could notbe looked up with resolveip.
This probably means that your libc librariesare not 100 % compatible
with this binary MySQL version. The MySQLdaemon, mysqld, should work
normally with the exception that host nameresolving will not work.
This means that you should use IP addressesinstead of hostnames
when specifying MySQL privileges !
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 placefor your system
PLEASE REMEMBER TO SET A PASSWORD FOR THEMySQL root USER !
To do so, start the server, then issue thefollowing commands:
/usr/local/mysql//bin/mysqladmin -u rootpassword 'new-password'
/usr/local/mysql//bin/mysqladmin -u root -hserv01.host.com password 'new-password'
Alternatively you can run:
/usr/local/mysql//bin/mysql_secure_installation
which will also give you the option ofremoving the test
databases and anonymous user created bydefault. 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 withmysql-test-run.pl
cd /usr/local/mysql//mysql-test ; perlmysql-test-run.pl
Please report any problems with the/usr/local/mysql//scripts/mysqlbug script!
第十二步,启动MySQL,如果出现SUCCESS,恭喜您,MySQL启动成功;如果出错,不要着急,根据日志排查错误
[root@serv01 mysql-5.5.29]#/etc/init.d/mysqld start
Starting MySQL.. SUCCESS!
[root@serv01 mysql-5.5.29]# ll/usr/local/mysql/data/ -d
drwxr-xr-x. 5 mysql mysql 4096 Sep 4 23:39 /usr/local/mysql/data/
第十三步,添加环境变量,并使其生效
[root@serv01 mysql-5.5.29]# vim~/.bash_profile
[root@serv01 mysql-5.5.29]# . !$
. ~/.bash_profile
[root@serv01 mysql-5.5.29]# cat ~/.bash_profile| grep PATH
PATH=/usr/local/mysql/bin/:$PATH:$HOME/bin
export PATH
第十四步,登录mysql,查看版本,如果出现版本号,则证明安装成功
[root@serv01 mysql-5.5.29]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.29-log Sourcedistribution
Copyright (c) 2000, 2012, Oracle and/or itsaffiliates. All rights reserved.
Oracle is a registered trademark of OracleCorporation and/or its
affiliates. Other names may be trademarks oftheir respective
owners.
Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.
mysql> select version();
+------------+
| version() |
+------------+
| 5.5.29-log |
+---