CentOS下安装Mysql

安装mysql-server

1.利用VMWare tools拷贝mysql安装包server和client 至centos根目录中的opt(一般 的第三方包目录)

2.在opt下打开终端检查是否安装过mysql:命令rpm -qa|grep -i mysql
若提示有安装过则可以进行卸载,如实系统自带的mysql-libs-5.1.71-1.el6.x86_64
,则可以:rpm -e –nodeps mysql-libs-5.1.71-1.el6.x86_64
进行卸载,再次查看rpm -qa|grep -i mysql

3.利用rpm -ivh MySQL-server-5.5.54-1.linux2.6.x86_64.rpm 命令进行安装(以MySQL-server-5.5.54-1.linux2.6.x86_64.rpm为例)

warning: MySQL-server-5.5.54-1.linux2.6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-server           ########################################### [100%]
warning: user mysql does not exist - using root
warning: group mysql does not exist - using root
170401 13:12:02 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
170401 13:12:02 [Note] /usr/sbin/mysqld (mysqld 5.5.54) starting as process 2986 ...
170401 13:12:02 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
170401 13:12:02 [Note] /usr/sbin/mysqld (mysqld 5.5.54) starting as process 2993 ...

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 localhost.localdomain 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.

Please report any problems at http://bugs.mysql.com/

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
提示你要设置mysql最高权限root用户的密码
命令:
/usr/bin/mysqladmin -u root password ‘new-password’
/usr/bin/mysqladmin -u root -h localhost.localdomain password ‘new-password’
可在之后进行

安装mysql-client

1.同样执行rpm -ivh MySQL-client-5.5.54-1.linux2.6.x86_64.rpm (以MySQL-client-5.5.54-1.linux2.6.x86_64.rpm 为例)

2.客户端安装完毕后,没有提示,Linux中没消息就是最好的消息

3.执行 mysqladmin –version若出现以下提示则成功
mysqladmin Ver 8.42 Distrib 5.5.54, for Linux on x86_64

设置mysql的自启动服务

1.在opt 下执行chkconfig mysql on命令设置开机自启动
2.chkconfig –list|grep mysql
mysql 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭表示Mysql的运行级别
3.检查开机启动设置是否成功命令,ntsysv,出现的土土的框中若mysql的前面的中括号是如果有*则成功

Mysql的安装位置

1.mysql中的数据库文件默认在etc/var/lib/mysql;
这里写图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值