博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CentOS6.5和RedHat6.5下以rpm方式安装mysql-5.6.20
阅读量:6877 次
发布时间:2019-06-26

本文共 3574 字,大约阅读时间需要 11 分钟。

转帖;http://blog.csdn.net/mw08091020/article/details/39234207

a.检查下linux是不是已经安装了mysql

rpm -qa | grep -i mysql#如果安装了先卸载旧的版本    yum -y remove mysql...

b.下载需要的安装包,下载地址:

http://cdn.mysql.com/Downloads/MySQL-5.6/MySQL-client-5.6.20-1.el6.x86_64.rpmhttp://cdn.mysql.com/Downloads/MySQL-5.6/MySQL-devel-5.6.20-1.el6.x86_64.rpmhttp://cdn.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.20-1.el6.x86_64.rpm

c、开始逐个安装

rpm -ivh MySQL-server-5.6.20-1.el6.x86_64.rpmrpm -ivh MySQL-devel-5.6.20-1.el6.x86_64.rpmrpm -ivh MySQL-client-5.6.20-1.el6.x86_64.rpm

d.修改配置文件位置并做相关设置

cp /usr/share/mysql/my-default.cnf /etc/my.cnfvi /etc/my.cnf#做如下配置  [client]password = 123456port = 3306default-character-set=utf8[mysqld]port = 3306character_set_server=utf8character_set_client=utf8collation-server=utf8_general_ci#linux下mysql安装完后是默认:表名区分大小写,列名不区分大小写; 0:区分大小写,1:不区分大小写lower_case_table_names=1#设置最大连接数,默认为 151,MySQL服务器允许的最大连接数16384max_connections=1000[mysql]default-character-set = utf8

e.初始化MySQL及设置密码

/usr/bin/mysql_install_dbservice mysql start

f.登录到mysql,第一次装没有密码,直接回车

mysql -uroot -p#设置root用户的密码mysql> update user set password=password('123456') where user='root';

g.设置允许远程登录

mysql> use mysql;mysql> select host,user,password from user;mysql> update user set host='%' where user='root' and host='localhost';mysql> flush privileges;mysql> exit;

h.设置开机自启动

chkconfig mysql onchkconfig --list | grep mysql

i. MySQL的默认安装位置说明

/var/lib/mysql/   #数据库目录/usr/share/mysql  #配置文件目录/usr/bin          #相关命令目录/etc/init.d/mysql #启动脚本                                                                                     注:卸载mysql的时候,将这些目录下的文件也删掉。
j.可能遇到的错误(一)
2014-01-21 06:03:29 14964 [ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if      non-zero) pages!2014-01-21 06:03:29 14964 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you   should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of  zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!2014-01-21 06:03:29 14964 [ERROR] Plugin 'InnoDB' init function returned error.2014-01-21 06:03:29 14964 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.2014-01-21 06:03:29 14964 [ERROR] Unknown/unsupported storage engine: InnoDB2014-01-21 06:03:29 14964 [ERROR] Aborting在/var/lib/mysql/目录下删掉这三个文件:ibdata1 ib_logfile0 ib_logfile1 然后重启mysqlcd /var/lib/mysqlrm ibdata1 ib_logfile0 ib_logfile1service mysql start
k.可能遇到的错误(二)
[root@localhost local]# mysql -uroot -pEnter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)方法操作很简单,如下:# /etc/init.d/mysql stop# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &# mysql -u root mysql//把空的用户密码都修改成非空的密码。mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root' and host='root' or host='localhost';mysql> FLUSH PRIVILEGES;mysql> quit # /etc/init.d/mysqld restart# mysql -uroot -pEnter password: 
<输入新设的密码newpassword>
l.可能遇到的错误(三)
mysql> show databases;ERROR 1820 (HY000): You must SET PASSWORD before executing this statement这句话要求你重新设置一次密码!mysql>  SET PASSWORD = PASSWORD('123456');Query OK, 0 rows affected (0.03 sec)mysql> create database roger;Query OK, 1 row affected (0.00 sec)
参考:http://blog.csdn.net/liumm0000/article/details/18841197
你可能感兴趣的文章
虚拟化系列-VMware vSphere 5.1 VDP备份管理
查看>>
Java笔记2:Eclipse编写第一个Java程序
查看>>
【足迹C++primer】表达式求值
查看>>
javascript小白学习指南0---1
查看>>
C#实现接口xml序列化与反序列化
查看>>
[译]Godot系列教程一 - 场景与节点
查看>>
BUG级别定义标准
查看>>
Java常考面试题(经典)
查看>>
认清世界,认清自我,超凡脱俗
查看>>
如何在Fedora 22上面配置Apache的Docker容器
查看>>
Swift 控制流
查看>>
【开源】简单4步搞定QQ登录,无需什么代码功底【无语言界限】
查看>>
C语言接口与实现实例
查看>>
含有汉字的固定字符由ZHS16GBK数据库导入到AL32UTF8的数据库
查看>>
php-fpm进程数优化
查看>>
iOS中如何对具有复杂依赖的SDK在真机上进行单元测试
查看>>
Mobile Web中URL设计问题
查看>>
core Animation之CAAnimationGroup(动画群组)
查看>>
重构实践:体验interface的威力(一)
查看>>
UILabel混合显示动画效果
查看>>