当前位置: 首页 > news >正文

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

相关文章:

  • centos下JDBC的安装配置
  • linux下java程序的编译过程
  • LDAP讲解以及LDAP BROWSER的使用(附下载链接)
  • 数字证书的几种格式:DER,PEM,CER,PFX
  • 数字证书有效性验证
  • Linux系统网卡配置详解以及—常见问题的解决方法以及—硬盘移植后网卡的配置
  • 实习总结2
  • 验签名的完整流程---以及数字证书的申请流程
  • LINUX下PHP生成并调用C的.so文件
  • linux下apache+php的安装配置(源码)
  • linux多文件编译—makefile
  • linux下,使用php将C扩展打包成.so文件补充——动态库
  • 安装第三方yum源
  • cannot find -lxxx
  • linux下的环境变量配置
  • Angular 2 DI - IoC DI - 1
  • CSS 专业技巧
  • CSS盒模型深入
  • el-input获取焦点 input输入框为空时高亮 el-input值非法时
  • spring-boot List转Page
  • XML已死 ?
  • 程序员该如何有效的找工作?
  • 分享几个不错的工具
  • 互联网大裁员:Java程序员失工作,焉知不能进ali?
  • 想使用 MongoDB ,你应该了解这8个方面!
  • 自动记录MySQL慢查询快照脚本
  • 国内开源镜像站点
  • 国内唯一,阿里云入选全球区块链云服务报告,领先AWS、Google ...
  • 你学不懂C语言,是因为不懂编写C程序的7个步骤 ...
  • # 数论-逆元
  • #快捷键# 大学四年我常用的软件快捷键大全,教你成为电脑高手!!
  • ${ }的特别功能
  • %3cscript放入php,跟bWAPP学WEB安全(PHP代码)--XSS跨站脚本攻击
  • (09)Hive——CTE 公共表达式
  • (C++)栈的链式存储结构(出栈、入栈、判空、遍历、销毁)(数据结构与算法)
  • (C语言)逆序输出字符串
  • (html5)在移动端input输入搜索项后 输入法下面为什么不想百度那样出现前往? 而我的出现的是换行...
  • (二)换源+apt-get基础配置+搜狗拼音
  • (附源码)spring boot公选课在线选课系统 毕业设计 142011
  • (附源码)springboot教学评价 毕业设计 641310
  • (十八)devops持续集成开发——使用docker安装部署jenkins流水线服务
  • (十二)devops持续集成开发——jenkins的全局工具配置之sonar qube环境安装及配置
  • (学习日记)2024.01.19
  • (转)JVM内存分配 -Xms128m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=512m
  • (转载)Linux网络编程入门
  • .【机器学习】隐马尔可夫模型(Hidden Markov Model,HMM)
  • .bat批处理出现中文乱码的情况
  • .htaccess配置常用技巧
  • .net core MVC 通过 Filters 过滤器拦截请求及响应内容
  • .NET Core Web APi类库如何内嵌运行?
  • .NET Framework杂记
  • .Net IE10 _doPostBack 未定义
  • .NET 将混合了多个不同平台(Windows Mac Linux)的文件 目录的路径格式化成同一个平台下的路径
  • .NET 中什么样的类是可使用 await 异步等待的?
  • .net操作Excel出错解决