mysql的rpm安装

来源:互联网 发布:金融建模需要会编程吗 编辑:程序博客网 时间:2024/05/16 06:51

MYSQL在centos6中的安装

  • MYSQL在centos6中的安装
    • 需要下载的包
      • 需要下载三个rpm软件包
    • 安装
    • 修改配置文件位置
    • 初始化MySQL及修改MySQL默认的root密码
    • 设置MySQL服务开机自启动
  • 安装过程的错误的解决
  • 远程连接

需要下载的包

需要下载三个rpm软件包:

MySQL-client-5.6.21-1.rhel5.x86_64.rpm
MySQL-devel-5.6.21-1.rhel5.x86_64.rpm
MySQL-server-5.6.21-1.rhel5.x86_64.rpm

下载地址下载地址引用处:
http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.21-1.rhel5.x86_64.rpm
http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-devel-5.6.21-1.rhel5.x86_64.rpm
http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-client-5.6.21-1.rhel5.x86_64.rpm

安装

rpm -ivh MySQL-server-5.6.21-1.rhel5.x86_64.rpm
rpm -ivh MySQL-server-5.6.21-1.rhel5.x86_64.rpm
rpm -ivh MySQL-client-5.6.21-1.rhel5.x86_64.rpm
可能需要安装:libaio
yum install -y libaio

修改配置文件位置。

[root@linuxidc tools]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf

初始化MySQL及修改MySQL默认的root密码。

/usr/bin/mysql_install_db
ps -ef | grep mysql
netstat -anpt | grep 3306
more /root/.mysql_secret

mysql -uroot -pF6K3v_xggFoLQeiN
mysql> SET PASSWORD = PASSWORD(‘mima’);

[root@linuxidc tools]# mysql -uroot -pmima
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.6.21 MySQL Community Server (GPL)

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

设置MySQL服务开机自启动。

[root@linuxidc tools]# chkconfig mysql on
[root@linuxidc tools]# chkconfig mysql –list

安装过程的错误的解决

1、重点在centos6中使用mysql管理他的服务而不是mysqld
2、错误描述:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)这个问题属于mysql的服务没有开启。

解决方法:

systemctl start mysql(centos7)service mysql start(centos6)

3、错误描述:

file /usr/share/mysql/charsets/swe7.xml from install of MySQL-server-5.6.21-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_64

解决办法:

 yum remove mysql-libs

远程连接

1、mysql中执行

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;

这样在物理机的外面就可以访问vm中的linux了。

引用:http://www.linuxidc.com/Linux/2015-01/111413.htm

1 0
原创粉丝点击