当前位置:首页 > 开发 > 操作系统 > 正文

在Redhat中安装Mysql

发表于: 2013-09-10   作者:sunjing   来源:转载   浏览:
摘要: 一、Installing MySQL Using the MySQL Yum Repository 1.Adding the MySQL Yum Repository wget http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm sudo yum localinstall mysql-community-r
一、Installing MySQL Using the MySQL Yum Repository
1.Adding the MySQL Yum Repository

wget http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

sudo yum localinstall mysql-community-release-el6-5.noarch.rpm
2.Installing MySQL with Yum

sudo yum install mysql-community-server
3.editing /etc/my.cnf

[mysqld]
innodb_buffer_pool_size = 2G
join_buffer_size = 128M
sort_buffer_size = 6M
read_rnd_buffer_size = 2M
character-set-server=utf8
key_buffer_size = 512M
max_allowed_packet = 10M
thread_stack = 256K
myisam_sort_buffer_size = 64M
max_connections = 1000

symbolic-links=0
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

 

4.Starting the MySQL Server

sudo service mysqld start

5.Securing the MySQL Installation
Invoke mysql_secure_installation without arguments:

shell> mysql_secure_installation
When executed, the script prompts you to determine which actions to perform.

 

二、使用rpm包安装

安装时请使用root用户。安装前准备两个rpm包:

MySQL-server-5.6.12-1.el6.x86_64.rpm

MySQL-client-5.6.12-1.el6.x86_64.rpm

1、安装服务端:

命令:rpm -ivh MySQL-server-5.6.12-1.el6.x86_64.rpm

2、安装客户端

命令:rpm -ivh MySQL-client-5.6.12-1.el6.x86_64.rpm

3、在Redhat中是不能使用空密码登录mysql的,请依次执行以下命令:

su root
       service mysql stop
       mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
       mysql -u root mysql
       UPDATE user SET Password=PASSWORD('123456') where USER='root';
       FLUSH PRIVILEGES;
       quit
       exit
       ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
       service mysql start
    执行完毕后,再次登录

mysql -uroot -p123456

4、登录后执行mysql命令时,还会提示设置密码,再次运行以下命令:

SET Password=PASSWORD('123456')

在Redhat中安装Mysql

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号