首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

redhat6.3装配MySQL-server-5.6.13-1.el6.x86_64.rpm

2013-09-07 
redhat6.3安装MySQL-server-5.6.13-1.el6.x86_64.rpm首先下载下面三个文件:[root@localhost download]# rp

redhat6.3安装MySQL-server-5.6.13-1.el6.x86_64.rpm

首先下载下面三个文件:

  • [root@localhost download]# rpm -ivh --replacefiles MySQL-server-5.6.13-1.el6.x86_64.rpm   
  • Preparing...                ########################################### [100%]  
  •    1:MySQL-server           ########################################### [100%]  
  • [root@localhost download]# rpm -ivh --replacefiles MySQL-client-5.6.13-1.el6.x86_64.rpm   
  • Preparing...                ########################################### [100%]  
  •    1:MySQL-client           ########################################### [100%]  
  • [root@localhost download]# rpm -ivh --replacefiles MySQL-devel-5.6.13-1.el6.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进程:

    1. [root@localhost ~]# ps -ef | grep mysql  
    2. root     26047     1  0 18:14 pts/12   00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/localhost.localdomain.pid  
    3. mysql    26227 26047  0 18:14 pts/12   00:00:01 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/lib/mysql/localhost.localdomain.pid --socket=/var/lib/mysql/mysql.sock  
    4. root     26545 24726  0 18:27 pts/8    00:00:00 grep mysql
    4.第一次登陆设置root密码:

    首先查看 cat /root/.mysql_secret

    1. root@localhost ~]# cat /root/.mysql_secret   
    2. # The random password set for the root user at Fri Aug 30 15:57:18 2013 (local time): fMYcarvB
    然后命令行:mysql -u root -p ,然后输入上面的密码即可:

    1. [root@localhost ~]# mysql -u root -p  
    2. Enter password:   
    3. Welcome to the MySQL monitor.  Commands end with ; or \g.  
    4. Your MySQL connection id is 5  
    5. Server version: 5.6.13 MySQL Community Server (GPL)  
    6.   
    7. Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.  
    8.   
    9. Oracle is a registered trademark of Oracle Corporation and/or its  
    10. affiliates. Other names may be trademarks of their respective  
    11. owners.  
    12.   
    13. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    设置root密码: 

    1. mysql> use mysql  
    2. Database changed  
    3. mysql> update user set password=password('root') where user='root';  
    4. Query OK, 0 rows affected (0.15 sec)  
    5. Rows matched: 5  Changed: 0  Warnings: 0  
    6.   
    7. mysql> flush privileges;  
    8. Query OK, 0 rows affected (0.00 sec)
    退出,重新登陆即可使用新的密码登陆;

    5. 设置远程登陆:

    使用root登陆到mysql后

    1. mysql> update user set host='%' where user='root';  
    2. ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'  
    3. mysql> select host,user from user;  
    4. +-----------------------+------+  
    5. | host                  | user |  
    6. +-----------------------+------+  
    7. | %                     | root |  
    8. | 127.0.0.1             | root |  
    9. | 192.168.128.142       | root |  
    10. | ::1                   | root |  
    11. | localhost.localdomain | root |  
    12. +-----------------------+------+  
    13. 5 rows in set (0.00 sec)
    然后:  

    1. mysql> grant all privileges on *.* to 'root'@'%' with grant option;  
    2. Query OK, 0 rows affected (0.08 sec)  
    3.   
    4. mysql> exit  
    5. Bye  
    6. [root@localhost ~]# service mysql restart  
    7. Shutting down MySQL.. SUCCESS!   
    8. Starting MySQL.. SUCCESS!   
    重启mysql即可远程登陆。

    分享,快乐,成长


    转载请注明出处:http://blog.csdn.net/fansy1990

     

  • 热点排行