linux下安装mysql5.6

系统版本:Redhat6-64

1.安装mysql服务器

安装前检查:rpm -qa|grep -i mysql,如果已有,请卸载。参加卸载部分

rpm -ivh MySQL-server-5.6.14-1.el6.x86_64.rpm 

启动
/etc/init.d/mysql start


如果有报错信息路径:
/var/lib/mysql/*.err
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

则需要用户表初始化:
mysql_install_db --user=mysql

然后再启动,正常。

2.安装mysql客户端

rpm -ivh MySQL-client-5.6.14-1.el6.x86_64.rpm 


更新root账号的密码:
 /usr/bin/mysqladmin -u root password 'root123'
 /usr/bin/mysqladmin -u root -h cxoa003 password 'root123'


创建另外一个超级用户:

grant all on *.* to 'hfd'@'%' identified by 'hfd123';
flush privileges;





3.其他配置

导入数据时,报错2006,Mysql has gone away! 


修改链接时间和最大包size
vi /usr/my.cnf
max_allowed_packet = 200M
wait_timeout=2880000
interactive_timeout = 2880000
或者sql = "set interactive_timeout=24*3600";
          set global max_allowed_packet=300000000;   

--  导出时的缓冲区

        set global net_buffer_length=300000;  


帐号不允许从远程或本地登陆

只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"。或者本地登录时报错。


2.屏蔽权限登录
   # mysqld_safe --skip-grant-table
   屏幕出现: Starting demo from .....
3.新开起一个终端输入
   # mysql -u root mysql
   #delete from user where host='cxoa003';

mysql -u root -p root123

mysql>use mysql;
mysql>update user set host = '%' where user = 'root' and host='localhost';
mysql>select host, user from user;[/pre]

mysql>flush privileges; 

有时需要先重新更新一下root的密码:

UPDATE user SET Password=PASSWORD('root123') where USER='root';

4.卸载MySQL

检查: rpm -qa|grep -i mysql
卸载安装包: rpm -e 每个mysql服务,如果有depends无法卸载,如
[root@cxoa003 local]# rpm -e mysql-libs-5.1.47-4.el6.x86_64
error: Failed dependencies:
        libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-2.el6.x86_64
        libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-2.el6.x86_64
        mysql-libs is needed by (installed) postfix-2:2.6.6-2.el6.x86_64
使用 pm -e --nodeps mysql-libs-5.1.47-4.el6.x86_64卸载。
删除服务:
chkconfig --list | grep -i mysql  
chkconfig --del mysql 
删除目录:where is mysql rm -rf 所有mysql的目录


      

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值