centos6.5下使用yum安装mysql

centos6.5下使用yum安装mysql
查看centos上是否安装了mysql 数据库
# rpm -qa|grep mysql

停止mysql服务
#service mysqld stop

卸载centOs自带的mysql数据库
# rpm -ev --nodeps mysqlxxx

查找并且删除之前老版本mysql的目录并且删除老版本mysql的文件和库
# find / -name mysql


删除对应的mysql 目录
# rm -rf 目录


再次复查
# rpm -qa|grep mysql


查看yum上提供的mysql数据库可下载的版本
# yum list|grep mysql
/*运行结果:*******************************************/


安装:
# yum install -y mysql-server mysql mysql-devel
/*运行结果:********************************************/
..................省略部分以上内容


查看刚安装好的mysql版本
# rpm -qi mysql-server
/*运行结果:********************************************************************************************************************/

翻译:
介绍: MySQL是一个多用户,多线程SQL数据库服务器。MySQL是一个由服务器保护进程(mysqld)组成的 客户端/服务器 的实现以及许多不同客户端程序和库。
这个包包含了MySQL服务器和一些附带文件和目录。
【注意:安装好mysql后会出现一个 mysqld 的进程!】

启动msyql
#service mysqld start
/*运行结果:****************************************************/
[root@kiven-centos ~]# service mysqld start
Initializing MySQL database: WARNING: The host 'kiven-centos' 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 kiven-centos 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!
/*运行结果【end】****************************************************/

翻译:
初始化MySQL数据库:警告:主机的“kivencentos”不能用resoleip查找。
这可能意味着您的libc库并不是100%兼容的
使用这个二进制MySQL版本。MySQL守护进程mysqld应该工作
通常情况下,主机名解析不会起作用。
这意味着你应该使用IP地址而不是主机名
在指定MySQL特权时!
安装MySQL系统表……
------
要在启动时启动mysqld,必须复制
支持文件/ mysql。服务器到您的系统的正确位置
-------
请记住为MySQL根用户设置密码!
为此,启动服务器,然后发出以下命令:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h kiven-centos password 'new-password'
------
或者您可以运行:
/usr/bin/mysql_secure_installation
这也可以让你选择取消测试
默认情况下创建的数据库和匿名用户。这是
强烈推荐生产服务器。
---------
更多的说明请参阅手册。
您可以启动MySQL守护进程:
cd /usr ; /usr/bin/mysqld_safe &
---------
您可以使用MySQL-test-run.pl来测试MySQL守护进程。
cd /usr/mysql-test ; perl mysql-test-run.pl
-----------
请报告/usr/bin/mysqlbug脚本的任何问题!

这段话的重点:
1、在安装mysql后,会创建一个 msyqld进程
2、设置root密码 :mysqladmin -u root password 'new-password'

重启MySql服务器
# service mysqld restart
/*运行结果:********************************************************************************************************************/
Stopping mysqld: [ OK ]
Starting mysqld:
/*运行结果:********************************************************************************************************************/

查看mysql状态
# service mysqld status
/*运行结果:********************************************************************************************************************/
mysqld (pid 2083) is running...
/*运行结果:********************************************************************************************************************/

检查 mysql 服务是否开机自动启动
# chkconfig --list|grep mysqld
/*运行结果:********************************************************************************************************************/
mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off
/*********************************************************************************************************************/

设置mysql服务开机启动
# chkconfig mysqld on
/***************************************************************************************/
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
/***************************************************************************************/

设置mysql 管理员密码
# mysqladmin -u root password '123456'

使用root登陆mysql
# mysql -u root -p


查看mysql端口号
# netstat -anp|grep 3306

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值