CentOS6下安装MySQL数据库服务
2015-08-03 23:19
579 查看
大家好,今天是我在51CTO上的第一篇博文,以此来督促我自个养成一个好的学习习惯,也希望给大家有所帮助。
ok,言归正传,今天我介绍的是在CentOS6环境下安装MySQL数据库,我所用到的是CentOS6镜像文件中所带的mysql包。
1、配置本地yum源。
[root@server ~]# cd /etc/yum.repos.d/
[root@server yum.repos.d]# ls
CentOS-Base.repo.bak CentOS-Debuginfo.repo.bak CentOS-fasttrack.repo.bak CentOS-Media.repo CentOS-Vault.repo.bak
修改如下:
[root@server yum.repos.d]# vim CentOS-Media.repo
baseurl=file:///mnt */mnt为挂载点*
enabled=1 *开启状态*
2、安装mysql。
[root@server ~]# yum list | grep mysql *查询与mysql有关的包*
[root@server ~]# yum install -y mysql-server.x86_64 mysql.x86_64 mysql-devel.x86_64 *安装mysql包和开发所用到的包*
[root@server ~]# service mysqld start *初始化mysql数据库*
[root@server ~]# service mysqld restart *重启mysql服务*
[root@server ~]# mysqladmin -u root password '123456' *配置管理mysql的用户的密码*
[root@server ~]# mysql -u root -p
Enter password: *登录mysql,输入管理密码*
出现如下,表示登录成功:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
相关命令: show databases; *查看目前有的数据库*
create database ming; *创建名字为ming的数据库*
3、mysql的配置文件。
[root@server ~]# cd /etc/
[root@server etc]# ls my.cnf
my.cnf
4、mysql数据库的库所在位置。
[root@server ~]# cd /var/lib/mysql/
[root@server mysql]# ls
ibdata1 ib_logfile0 ib_logfile1 ming mingming mysql mysql.sock test
5、mysql数据库的日志文件所在位置。
[root@server ~]# cd /var/log/
[root@server log]# ls
anaconda.ifcfg.log btmp dmesg maillog-20150802 prelink spooler-20150714
anaconda.log btmp-20150802 dmesg.old mcelog sa spooler-20150719
anaconda.program.log ConsoleKit dracut.log messages samba spooler-20150730
anaconda.storage.log cron httpd messages-20150714 secure spooler-20150802
anaconda.syslog cron-20150714 lastlog messages-20150719 secure-20150714 sssd
anaconda.xlog cron-20150719 maillog messages-20150730 secure-20150719 tallylog
anaconda.yum.log cron-20150730 maillog-20150714 messages-20150802 secure-20150730 wtmp
audit cron-20150802 maillog-20150719 mysqld.log secure-20150802 yum.log
boot.log cups maillog-20150730 ntpstats spooler
[root@server log]# cat mysqld.log
Version: '5.1.73' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
*mysql服务是TCP,端口号为3306*
6、监听mysql服务。
[root@server ~]# netstat -tlun
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
******此文结束*******
2015-8-3
本文出自 “努力!奋斗!” 博客,请务必保留此出处http://026mm.blog.51cto.com/8783374/1681434
ok,言归正传,今天我介绍的是在CentOS6环境下安装MySQL数据库,我所用到的是CentOS6镜像文件中所带的mysql包。
1、配置本地yum源。
[root@server ~]# cd /etc/yum.repos.d/
[root@server yum.repos.d]# ls
CentOS-Base.repo.bak CentOS-Debuginfo.repo.bak CentOS-fasttrack.repo.bak CentOS-Media.repo CentOS-Vault.repo.bak
修改如下:
[root@server yum.repos.d]# vim CentOS-Media.repo
baseurl=file:///mnt */mnt为挂载点*
enabled=1 *开启状态*
2、安装mysql。
[root@server ~]# yum list | grep mysql *查询与mysql有关的包*
[root@server ~]# yum install -y mysql-server.x86_64 mysql.x86_64 mysql-devel.x86_64 *安装mysql包和开发所用到的包*
[root@server ~]# service mysqld start *初始化mysql数据库*
[root@server ~]# service mysqld restart *重启mysql服务*
[root@server ~]# mysqladmin -u root password '123456' *配置管理mysql的用户的密码*
[root@server ~]# mysql -u root -p
Enter password: *登录mysql,输入管理密码*
出现如下,表示登录成功:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
相关命令: show databases; *查看目前有的数据库*
create database ming; *创建名字为ming的数据库*
3、mysql的配置文件。
[root@server ~]# cd /etc/
[root@server etc]# ls my.cnf
my.cnf
4、mysql数据库的库所在位置。
[root@server ~]# cd /var/lib/mysql/
[root@server mysql]# ls
ibdata1 ib_logfile0 ib_logfile1 ming mingming mysql mysql.sock test
5、mysql数据库的日志文件所在位置。
[root@server ~]# cd /var/log/
[root@server log]# ls
anaconda.ifcfg.log btmp dmesg maillog-20150802 prelink spooler-20150714
anaconda.log btmp-20150802 dmesg.old mcelog sa spooler-20150719
anaconda.program.log ConsoleKit dracut.log messages samba spooler-20150730
anaconda.storage.log cron httpd messages-20150714 secure spooler-20150802
anaconda.syslog cron-20150714 lastlog messages-20150719 secure-20150714 sssd
anaconda.xlog cron-20150719 maillog messages-20150730 secure-20150719 tallylog
anaconda.yum.log cron-20150730 maillog-20150714 messages-20150802 secure-20150730 wtmp
audit cron-20150802 maillog-20150719 mysqld.log secure-20150802 yum.log
boot.log cups maillog-20150730 ntpstats spooler
[root@server log]# cat mysqld.log
Version: '5.1.73' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
*mysql服务是TCP,端口号为3306*
6、监听mysql服务。
[root@server ~]# netstat -tlun
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
******此文结束*******
2015-8-3
本文出自 “努力!奋斗!” 博客,请务必保留此出处http://026mm.blog.51cto.com/8783374/1681434
相关文章推荐
- linux 线程学习之条件变量
- Linux互通SSH免密码访问
- 关于重装系统后,Windows和Linux双系统只能进入一个的问题
- 扩展虚拟机内系统centos6.6硬盘空间
- Linux 开关中断系列函数探究
- Unix/linux进程及线程间同步技术总结【学习总结,请勿吐槽。。。】
- Linux写时拷贝技术(copy-on-write)
- centos 6实现ssh无密码登录的简便方法
- CentOS下使用文件构建swap
- 嵌入式linux之块设备驱动程序概念,框架
- linux tr命令详解
- Linux OOM killer 机制
- linux下虚拟文件系统
- Linux系统编程(1)——文件与I/O之C标准I/O函数与系统调用I/O
- linux_c 开发(5-6)进程间通讯_信号量
- Linux的五个查找命令(find、locate、whereis、which、type)
- Linux宿主机与目标机通信之minicom安装配置
- linux inode
- linux ack学习
- Linux alias 命令