redhat6.4安裝MySQL-server-5.5.28-1.linux2.6.x86_64.rpm

首先下載下面三個文件:mysql

MySQL-server-5.5.28-1.linux2.6.x86_64.rpmlinux

MySQL-client-5.5.28-1.linux2.6.x86_64.rpmsql

MySQL-devel-5.5.28-1.linux2.6.x86_64.rpm數據庫

而後使用root帳號登錄,進行安裝:dom

1. 安裝server、devel、client:1. 安裝server、devel、client:ui

 

rpm -ivh --replacefiles MySQL-s*.rpmthis

rpm -ivh --replacefiles MySQL-d*.rpm命令行

 

rpm -ivh --replacefiles MySQL-c*.rpmrest

 

 

[root@localhost ~]# rpm -ivh --replacefiles MySQL-server-5.5.28-1.linux2.6.x86_64.rpm  orm

Preparing...                ########################################### [100%] 

   1:MySQL-server           ########################################### [100%] 

[root@localhost ~]# rpm -ivh --replacefiles MySQL-client-5.5.28-1.linux2.6.x86_64.rpm

Preparing...                ########################################### [100%] 

   1:MySQL-client           ########################################### [100%] 

[root@localhost ~]# rpm -ivh --replacefiles MySQL-devel-5.5.28-1.linux2.6.x86_64.rpm  

Preparing...                ########################################### [100%] 

   1:MySQL-devel            ########################################### [100%]

要移除安裝能夠使用 rpm -e MySQL-server  、 rpm -e MySQL-devel、MySQL-client便可;

2. 初始化數據庫:

 

/usr/bin/mysql_install_db

 

3. 啓動mysql服務:

 

service mysql start

 

使用命令ps -ef | grep mysql 查看mysql進程:

  [root@localhost ~]#  ps -ef|grep mysql root       3708   3057  0 18:39 pts/1    00:00:00 grep mysql

4.第一次登錄設置root密碼:

首先查看 cat /root/.mysql_secret //有時候找不到那就先無論 往下看

  root@localhost ~]# cat /root/.mysql_secret

# The random password set for the root user at Fri Aug 30 15:57:18 2013 (local time): fMYcarvB   這部網上說這樣反正我沒成功

而後命令行:mysql -u root -p ,而後輸入上面的密碼便可:

[root@localhost ~]# mysql -uroot -p Enter password: Welcome to the MySQL monitor.  Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.5.28 MySQL Community Server (GPL)

Copyright (c) 2000, 2012, 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.

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

設置root密碼:

 

mysql> use mysql 

Database changed 

mysql> update user set password=password('root') where user='root'; 

Query OK, 0 rows affected (0.15 sec) 

Rows matched: 5  Changed: 0  Warnings: 0 

 

mysql> flush privileges; 

Query OK, 0 rows affected (0.00 sec)

退出,從新登錄便可使用新的密碼登錄;

5. 設置遠程登錄:

使用root登錄到mysql後

切換到mysql數據庫

mysql> show databases; +--------------------+ | Database           | +--------------------+ | information_schema | | mysql              | | performance_schema | | test               | +--------------------+ 4 rows in set (0.00 sec)

mysql> update user set host='%' where user='root'; ERROR 1046 (3D000): No database selected mysql> use mysql Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A

Database changed mysql> update user set host='%' where user='root'; ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY' mysql> select host,user from user; +-----------------------+------+ | host                  | user | +-----------------------+------+ | %                     | root | | 127.0.0.1             | root | | ::1                   | root | | localhost             |      | | localhost.localdomain |      | | localhost.localdomain | root | +-----------------------+------+ 6 rows in set (0.00 sec)

 

而後: 

  mysql> grant all privileges on *.* to 'root'@'@' with grant option; ERROR 1105 (HY000): Malformed hostname (illegal symbol: '@') mysql> grant all privileges on *.* to 'root'@'%' with grant option; Query OK, 0 rows affected (0.00 sec)

 

mysql> exit 

Bye 

[root@localhost ~]# service mysql restart 

Shutting down MySQL.. SUCCESS!  

Starting MySQL.. SUCCESS!  

重啓mysql便可遠程登錄。

相關文章
相關標籤/搜索