您的位置:首页 > 产品设计 > 产品经理

Mysql rpm包安装

2016-04-26 14:39 519 查看
1.下载 MySQL-client-5.6.25-1.linux_glibc2.5.x86_64.rpm MySQL-devel-5.6.25-1.linux_glibc2.5.x86_64.rpm MySQL-server-5.6.25-1.linux_glibc2.5.x86_64.rpm这三个软件包,注意版本要一致:
2.安装三个RPM包,遇到冲突和依赖可以先删除相应的软件。
rpm -ivh MySQL-server-5.6.25-1.linux_glibc2.5.x86_64.rpm
rpm -ivh MySQL-client-5.6.25-1.linux_glibc2.5.x86_64.rpm
rpm -ivh MySQL-devel-5.6.25-1.linux_glibc2.5.x86_64.rpm
3.启动mysql
/etc/init.d/mysql start
/etc/rc.d/init.d/mysql #启动文件
/usr/share/my #包含my-default.cnf文件
/usr/my.cnf #主配置文件
/usr/lib64/mysql#mysql#库文件夹
/var/lib/mysql#数据库文件存放目录
4.登入mysql报错
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
5.先停用数据库服务
service mysqld stop
查看进程端口是否停用
ss -tnlp|grep mysql
进入MYSQL安全模式,通常会卡住,其实是在后台运行,所以一分钟后按Ctrl+C
/usr/bin/mysqld_safe --skip-grant-table &
然后以无密码登录
mysql -u root
6.修改密码
使用mysql数据库
use mysql
重设root密码
update user set password=PASSWORD("huaxia") where user='root';
刷新库
flush privileges;
退出
quit;
7.重新登入数据库
[root@sever9 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.25-log MySQL Community Server (GPL)
Copyright (c) 2000, 2015, 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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  数据库 RPM 包安装