centos下mysql的安装与配置

安装

1 yum list mysql-server

[join@bogon 桌面]$ yum list mysql-server
Loaded plugins: fastestmirror, refresh-packagekit, security
Determining fastest mirrors
 * base: mirror.bit.edu.cn
 * extras: mirrors.yun-idc.com
 * updates: mirror.bit.edu.cn
base                                                     | 3.7 kB     00:00     
extras                                                   | 3.4 kB     00:00     
updates                                                  | 3.4 kB     00:00     
Available Packages
mysql-server.x86_64                      5.1.73-7.el6                       bas


2 yum install mysql-server

[root@bogon 桌面]# yum install mysql-server.x86_64
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirrors.yun-idc.com

3 y

Is this ok [y/N]: y
Downloading Packages:
(1/5): mysql-5.1.73-7.el6.x86_64.rpm                     | 894 kB     00:02     
(2/5): mysql-libs-5.1.73-7.el6.x86_64.rpm                | 1.2 MB     00:10     


启动

1 service mysqld start

[root@bogon 桌面]# service mysqld start
初始化 MySQL 数据库: WARNING: The host 'bogon' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h bogon password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

                                                           [确定]
正在启动 mysqld:                                          [确定]
[root@bogon 桌面]# 


设置mysql开机启动

chkconfig mysqld on

开启3306端口并保存

/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

/etc/rc.d/init.d/iptables save

修改密码并设置远程访问

1

连接mysql数据库

设置密码

use mysql;

update user set password=password('密码') where user='root';

flush privileges;

2

设置Mysql远程访问

grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;

重启mysql服务

service mysald restart

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值