centos6.5使用yum安装mysql
2016-12-06 16:38
393 查看
要使用yum 安装mysql,要使用mysql的yum仓库,先从官网下载适合你系统的仓库
http://dev.mysql.com/downloads/repo/yum/
centos 6.5 对应的是mysql-community-release-el6-5.noarch.rpm
然后安装一下这个仓库列表
sudo yum localinstall mysql-community-release-el6-5.noarch.rpm
执行这个命令后就能看到可安装的mysql
yum repolist enabled | grep "mysql.*-community.*"
如果我们是要安装最新的版本,那么可以直接执行
sudo yum install mysql-community-server
如果我们要选择版本,可以先执行下面这个命令查看一下有哪些版本
yum repolist all | grep mysql
如果要选择版本的话,有两种方式,一种是使用命令来
shell> sudo yum-config-manager --disable mysql56-community
shell> sudo yum-config-manager --enable mysql57-community-dmr
这个命令就是在仓库中启用5.7版本的,禁用5.6版本子仓库
或者编辑/etc/yum.repos.d/mysql-community.repo文件
# Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=//repo.mysql.com/yum/mysql-5.6-community/el/5/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
enabled=0表示禁用
比如要安装5.7版本的mysql,要确定5.6的enabled=0,5.7的enabled=1,一次保证只启用一个子仓库
# Note: MySQL 5.7 is currently in development. For use at your own risk.
# Please read with sub pages: https://dev.mysql.com/doc/relnotes/mysql/5.7/en/
[mysql57-community-dmr]
name=MySQL 5.7 Community Server Development Milestone Release
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
然后我们又可以愉快的安装mysql了
sudo yum install mysql-community-server
安装完成后我们启动mysql
sudo service mysqld start
查看mysql状态
sudo service mysqld status
至此我就可以使用Yum简单地管理MySQL更新,并能确保总是从官网软件库得到最新的发布版。
附录:
1、root password update failed
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement.
解决办法:
[plain] view
plain copy
[**@localhost ~]# mysql
mysql> set global read_only=0;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
[**@localhost ~]# /usr/bin/mysql_secure_installation
如此便可以重新更新root密码了!
2、[ERROR] InnoDB: Cannot create log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
解决办法:进入你的mysql数据存放目录,删除ibdata1文件即可,例如在我的环境下
[plain] view
plain copy
#cd /var/lib/mysql
#mv ibdata1 ibdata1.bak
3、[ERROR] InnoDB: space header page consists of zero bytes in data file ./ibdata1
解决办法:修改配置文件my.cnf
根据个人环境空间大小和需求调节如下参数的值
[plain] view
plain copy
innodb_buffer_pool_size = 256M
innodb_log_file_size = 256M
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 2
添加一条:
[plain] view
plain copy
innodb_flush_method=normal
4、ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
解决办法:Google上有很多,我遇到这个情况的时候只是使用/usr/bin/mysql_secure_installation 重新设置一次。
至此我就可以使用Yum简单地管理MySQL更新,并能确保总是从官网软件库得到最新的发布版。
附录:
1、root password update failed
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement.
解决办法:
[plain] view
plain copy
[**@localhost ~]# mysql
mysql> set global read_only=0;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
[**@localhost ~]# /usr/bin/mysql_secure_installation
如此便可以重新更新root密码了!
2、[ERROR] InnoDB: Cannot create log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
解决办法:进入你的mysql数据存放目录,删除ibdata1文件即可,例如在我的环境下
[plain] view
plain copy
#cd /var/lib/mysql
#mv ibdata1 ibdata1.bak
3、[ERROR] InnoDB: space header page consists of zero bytes in data file ./ibdata1
解决办法:修改配置文件my.cnf
根据个人环境空间大小和需求调节如下参数的值
[plain] view
plain copy
innodb_buffer_pool_size = 256M
innodb_log_file_size = 256M
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 2
添加一条:
[plain] view
plain copy
innodb_flush_method=normal
4、ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
解决办法:Google上有很多,我遇到这个情况的时候只是使用/usr/bin/mysql_secure_installation 重新设置一次。
http://dev.mysql.com/downloads/repo/yum/
centos 6.5 对应的是mysql-community-release-el6-5.noarch.rpm
然后安装一下这个仓库列表
sudo yum localinstall mysql-community-release-el6-5.noarch.rpm
执行这个命令后就能看到可安装的mysql
yum repolist enabled | grep "mysql.*-community.*"
如果我们是要安装最新的版本,那么可以直接执行
sudo yum install mysql-community-server
如果我们要选择版本,可以先执行下面这个命令查看一下有哪些版本
yum repolist all | grep mysql
如果要选择版本的话,有两种方式,一种是使用命令来
shell> sudo yum-config-manager --disable mysql56-community
shell> sudo yum-config-manager --enable mysql57-community-dmr
这个命令就是在仓库中启用5.7版本的,禁用5.6版本子仓库
或者编辑/etc/yum.repos.d/mysql-community.repo文件
# Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=//repo.mysql.com/yum/mysql-5.6-community/el/5/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
enabled=0表示禁用
比如要安装5.7版本的mysql,要确定5.6的enabled=0,5.7的enabled=1,一次保证只启用一个子仓库
# Note: MySQL 5.7 is currently in development. For use at your own risk.
# Please read with sub pages: https://dev.mysql.com/doc/relnotes/mysql/5.7/en/
[mysql57-community-dmr]
name=MySQL 5.7 Community Server Development Milestone Release
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
然后我们又可以愉快的安装mysql了
sudo yum install mysql-community-server
安装完成后我们启动mysql
sudo service mysqld start
查看mysql状态
sudo service mysqld status
至此我就可以使用Yum简单地管理MySQL更新,并能确保总是从官网软件库得到最新的发布版。
附录:
1、root password update failed
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement.
解决办法:
[plain] view
plain copy
[**@localhost ~]# mysql
mysql> set global read_only=0;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
[**@localhost ~]# /usr/bin/mysql_secure_installation
如此便可以重新更新root密码了!
2、[ERROR] InnoDB: Cannot create log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
解决办法:进入你的mysql数据存放目录,删除ibdata1文件即可,例如在我的环境下
[plain] view
plain copy
#cd /var/lib/mysql
#mv ibdata1 ibdata1.bak
3、[ERROR] InnoDB: space header page consists of zero bytes in data file ./ibdata1
解决办法:修改配置文件my.cnf
根据个人环境空间大小和需求调节如下参数的值
[plain] view
plain copy
innodb_buffer_pool_size = 256M
innodb_log_file_size = 256M
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 2
添加一条:
[plain] view
plain copy
innodb_flush_method=normal
4、ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
解决办法:Google上有很多,我遇到这个情况的时候只是使用/usr/bin/mysql_secure_installation 重新设置一次。
至此我就可以使用Yum简单地管理MySQL更新,并能确保总是从官网软件库得到最新的发布版。
附录:
1、root password update failed
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement.
解决办法:
[plain] view
plain copy
[**@localhost ~]# mysql
mysql> set global read_only=0;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
[**@localhost ~]# /usr/bin/mysql_secure_installation
如此便可以重新更新root密码了!
2、[ERROR] InnoDB: Cannot create log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
解决办法:进入你的mysql数据存放目录,删除ibdata1文件即可,例如在我的环境下
[plain] view
plain copy
#cd /var/lib/mysql
#mv ibdata1 ibdata1.bak
3、[ERROR] InnoDB: space header page consists of zero bytes in data file ./ibdata1
解决办法:修改配置文件my.cnf
根据个人环境空间大小和需求调节如下参数的值
[plain] view
plain copy
innodb_buffer_pool_size = 256M
innodb_log_file_size = 256M
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 2
添加一条:
[plain] view
plain copy
innodb_flush_method=normal
4、ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
解决办法:Google上有很多,我遇到这个情况的时候只是使用/usr/bin/mysql_secure_installation 重新设置一次。
相关文章推荐
- Centos6.5使用yum安装mysql——快速上手必备
- Centos6.5使用yum安装mysql——快速上手必备
- Centos6.5使用yum安装mysql——快速上手必备
- Centos6.5使用yum安装mysql——快速上手必备
- Centos6.5使用yum安装mysql@http://blog.csdn.net/xxd851116/article/details/22947891
- centos6.5使用yum安装mysql5.6
- Centos6.5使用yum安装mysql
- Centos6.5使用yum安装mysql——快速上手必备(转)
- Centos6.5使用yum安装mysql——快速上手必备
- Centos6.5使用yum安装mysql——快速上手必备
- Centos6.5使用yum安装mysql——快速上手必备
- centos6.5使用yum安装mysql
- Centos6.5使用yum安装mysql——快速上手必备
- [转]Centos6.5使用yum安装mysql—配置MySQL允许远程登录
- Linux学习总结(4)——Centos6.5使用yum安装mysql——快速上手必备
- Centos6.5使用yum安装mysql——快速上手必备
- Linux学习总结(4)——Centos6.5使用yum安装mysql——快速上手必备
- Centos6.5使用yum安装mysql——快速上手必备
- Centos6.5使用yum安装mysql
- Centos6.5使用yum安装mysql