RedHat5安装Mysql5.1.7(一)

2015-01-25 20:30:03 · 作者: · 浏览: 11
[root@hqw ~]# cd /home/app/mysql
[root@hqw mysql]# ls

--解压
MySQL-community-5.1.73-1.rhel5.i386.rpm-bundle.tar
[root@hqw mysql]# tar -xvf MySQL-community-5.1.73-1.rhel5.i386.rpm-bundle.tar
MySQL-test-community-5.1.73-1.rhel5.i386.rpm
MySQL-embedded-community-5.1.73-1.rhel5.i386.rpm
MySQL-devel-community-5.1.73-1.rhel5.i386.rpm
MySQL-shared-compat-5.1.73-1.rhel5.i386.rpm
MySQL-shared-community-5.1.73-1.rhel5.i386.rpm
MySQL-server-community-5.1.73-1.rhel5.i386.rpm
MySQL-client-community-5.1.73-1.rhel5.i386.rpm
MySQL-community-debuginfo-5.1.73-1.rhel5.i386.rpm

--安装
[root@hqw mysql]# rpm -ivh *.rpm
Preparing... ########################################### [100%]
1:MySQL-shared-community ########################################### [ 13%]
2:MySQL-devel-community ########################################### [ 25%]
3:MySQL-client-community ########################################### [ 38%]
4:MySQL-community-debugin########################################### [ 50%]
5:MySQL-embedded-communit########################################### [ 63%]
6:MySQL-server-community ########################################### [ 75%]

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h hqw.net password 'new-password'

Alternatively you can run:
/usr/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.

Please report any problems with the /usr/bin/mysqlbug script!

Starting MySQL..[ OK ]
Giving mysqld 2 seconds to start
7:MySQL-shared-compat ########################################### [ 88%]
8:MySQL-test-community ########################################### [100%]

--重置root密码
[root@hqw mysql]# /usr/bin/mysqladmin -u root -h hqw.net password 'root'
[root@hqw mysql]# /usr/bin/mysqladmin -u root password 'root'

--启动服务
[root@hqw mysql]# service mysql start
Starting MySQL [ OK ]

--root登录
[root@hqw mysql]# mysql -uroot -proot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.73-community MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
select now(); +---------------------+ | now() | +---------------------+ | 2014-11-22 08:01:09 | +---------------------+ 1 row in set (0.00 sec) --新建远程账户 mysql> GRANT ALL PRIVILEGES ON *.* TO test@localhost IDENTIFIED BY 'test' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON *.* TO test@"%" IDENTIFIED BY 'test' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec) --刷新权限 mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> exit --远程数据库用户登录 [root@hqw mysql]# mysql -utest -ptest Welcome to the MySQ