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;
这里写图片描述

发布了5 篇原创文章 · 获赞 0 · 访问量 899
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览