码迷,mamicode.com
首页 > 数据库 > 详细

【linux】之安装mysql常用配置

时间:2016-10-23 21:17:03      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:iptables   ide   规则   更改密码   table   blog   搜索   res   用户   

下载mysql地址

http://dev.mysql.com/downloads/mysql/

选择下面这个

 

技术分享

 

查看是否存在mysql安装包

rpm -qa|grep -i mysql

删除mysql安装包 --nodeps 忽略依赖关系
rpm -e --nodeps mysql-libs-5.1.61-4.el6.i686

安装mysql服务端
rpm -ivh MySQL-server-5.5.50-1.el6.i686.rpm

安装mysql客户端
rpm -ivh MySQL-client-5.5.50-1.el6.i686.rpm

--------------------------------------------------------
配置mysql初始密码
mysqladmin -uroot password root

mysqladmin -u root -p password 1234

如果以上配置出现一下错误

技术分享

那么用以下方法

[root@localhost mysql]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

mysql> UPDATE user SET Password=PASSWORD(‘root‘) where USER=‘root‘;

mysql> FLUSH PRIVILEGES;

-------------------------------------------------------

mysql
登录进去之后更改密码
set password=password(‘123‘);

加入到系统服务列表
chkconfig --add mysql

自动启动
chkconfig mysql on

查看自动启动列表
chkconfig

 

登录mysql

例如,你想root使用root密码 从任何主机连接到mysql服务器的话。
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘IDENTIFIED BY ‘root‘ WITH GRANT OPTION;

如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器,并使用mypassword作为密码

GRANT ALL PRIVILEGES ON *.* TO ‘myuser‘@‘192.168.1.3‘IDENTIFIED BY

‘mypassword‘ WITH GRANT OPTION;

 

需要刷新一下才能生效
FLUSH PRIVILEGES

 

切换到外部

开放3306端口
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
保存防火墙规则
/etc/rc.d/init.d/iptables save
刷新防火墙规则
service iptables save
service iptables restart
以上两个都行

查看端口开放情况

/etc/init.d/iptables status 

ls | grep mysql 文件搜索

 

以上配置在centos6.3下,我将所有需要的依赖已经全部安装,如果出现相关错误,请安装相应的依赖lib文件

 

【linux】之安装mysql常用配置

标签:iptables   ide   规则   更改密码   table   blog   搜索   res   用户   

原文地址:http://www.cnblogs.com/gyjx2016/p/5990664.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!