SUSE 安装mysql
1.下载mysql rpm包
在该网站选择相应的包 http://dev.mysql.com/downloads/mysql/5.0.html
这里选择:MySQL-server-5.6.17-1.sles11.x86_64.rpm 和 MySQL-client-5.6.17-1.sles11.x86_64.rpm
安装这两个包,执行 rpm -ivh MySQL-server-5.6.17-1.sles11.x86_64.rpm
rpm -ivh MySQL-client-5.6.17-1.sles11.x86_64.rpm
2.启动mysql
/etc/init.d/mysql start
3.连接mysql
- [root@localhost bin]# ./mysql -uroot -p12345
- ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
遇到上面情况怎么办,请按如下步骤操作:
1、停止mysql服务
- [root@localhost bin]# chkconfig --list | grep -i mysql
- mysql 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
- [root@localhost bin]# service mysql stop
- Shutting down MySQL [确定]
2、用mysqld_safe重启服务
- [root@localhost bin]# ./mysqld_safe --user=root --skip-grant-tables --skip-networking &
- [1] 3818
- [root@localhost bin]# 111105 07:30:32 mysqld_safe Logging to '/usr/local/mysql/var/localhost.localdomain.err'.
- 111105 07:30:32 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
- ./mysql -uroot mysql
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 1
- Server version: 5.1.48-log Source distribution
- Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
- This software comes with ABSOLUTELY NO WARRANTY. This is free software,
- and you are welcome to modify and redistribute it under the GPL v2 license
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
3、重设密码
- mysql> update user set password=password('12345') where user='root' ;
- Query OK, 3 rows affected (0.05 sec)
- Rows matched: 3 Changed: 3 Warnings: 0
- mysql> flush privileges;
- Query OK, 0 rows affected (0.00 sec)
- mysql> quit
- Bye
4、重启服务
- [root@localhost bin]#service mysql stop
- [root@localhost bin]# service mysql start
5、再次连接数据库
- [root@localhost bin]# ./mysql -uroot -p12345
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 1
- Server version: 5.1.48-log Source distribution
- Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
- This software comes with ABSOLUTELY NO WARRANTY. This is free software,
- and you are welcome to modify and redistribute it under the GPL v2 license
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
--------------------------------------------------------------------------------------------------
增加MySQL用户,使之可以远程连接
格式:grant select on 数据库.* to 用户名@登录主机 identified by "密码"
例1、增加一个用户user_1密码为123,让他可以在任何主机上登录,并对所有数据库有查询、插入、修改、删除的权限。首先用以root用户连入MySQL,然后键入以下命令:
mysql> grant select,insert,update,delete on *.* to user_1@"%" Identified by "123";
例1增加的用户是十分危险的,如果知道了user_1的密码,那么他就可以在网上的任何一台电脑上登录你的MySQL数据库并对你的数据为所欲为了,解决办法见例2。
例2、增加一个用户user_2密码为123,让此用户只可以在localhost上登录,并可以对数据库aaa进行查询、插入、修改、删除的 操作(localhost指本地主机,即MySQL数据库所在的那台主机),这样用户即使用知道user_2的密码,他也无法从网上直接访问数据库,只能 通过MYSQL主机来操作aaa库。
mysql>grant select,insert,update,delete on aaa.* to user_2@localhost identified by "123";
用新增的用户如果登录不了MySQL,在登录时用如下命令:
mysql -u user_1 -p -h 192.168.113.50 (-h后跟的是要登录主机的ip地址)
SUSE 安装mysql的更多相关文章
- 安装MySQL -- SuSE Linux Enterprise Server 11 SP3
1.准备工作从MySQL官网上分别下载mysql服务器端于客户端包: MySQL-server-5.5.49-1.sles11.x86.rpm MySQL-client-5.5.49-1.sles11 ...
- SUSE Linux源代码编译安装MySQL 5.6
这篇文章主要介绍了SUSE Linux下源代码编译方式安装MySQL 5.6过程分享,本文使用SUSE Linux Enterprise Server 10 SP3 (x86_64)系统,须要的朋友能 ...
- 数据库(一):suse下MySQL安装
1.准备工作从MySQL官网上分别下载mysql服务器端于客户端包:MySQL-server-5.5.31-1.linux2.6.x86_64.rpmMySQL-client-5.5.31-1.lin ...
- lnmp安装--linux通过tar.gz源码包安装mysql
mysql版本:5.6 [http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.22.tar.gz] [http://dev.mysql.com/get ...
- Linux下基于源代码方式安装MySQL 5.6
MySQL为开源数据库,因此能够基于源代码实现安装.基于源代码安装有很多其它的灵活性. 也就是说我们能够针对自己的硬件平台选用合适的编译器来优化编译后的二进制代码.依据不同的软件平台环境调整相关的编译 ...
- Java全栈程序员之04:Ubuntu下安装MySQL、注册服务及Navcat
在安装MySQL之前,我们先来介绍一下Ubuntu下软件的安装方式.首先回顾下,我们安装JDK,使用的是后缀名为tar.gz的安装包.安装idea,使用的是tar.gz:那有没有别的安装方式呢? 1. ...
- 在SuSE安装wifidog认证服务器和网关
在SuSE安装认证服务器和网关 在openSuSE 10.3安装wifidog 认证服务器和网关在同台设备中安装完毕.以下是openSuSE的详细安装指南.这个安装是非常初级的,所以请验证或更正. - ...
- Centos6.5下编译安装mysql 5.6
一:卸载旧版本 使用下面的命令检查是否安装有MySQL Server rpm -qa | grep mysql 有的话通过下面的命令来卸载掉 rpm -e mysql //普通删除模式 rpm -e ...
- 在Ubuntu 16.10安装mysql workbench报未安装软件包 libpng12-0错误
1.安装mysql workbench,提示未安装软件包 libpng12-0 下载了MySQL Workbench 6.3.8 在安装的时候报错: -1ubu1604-amd64.deb 提示: ...
随机推荐
- ANT+JMETER集成2 (发送邮件)
折腾一天发现各种build源码都不能发送邮件,试了很多次,终于能发送邮件 先看成果 build源码贴出来 <?xml version="1.0" encoding=" ...
- spring的事物回滚
//默认spring只能在捕获到runtimeException时才会回滚, throw new RuntimeException("出现runtime异常"); } catch ...
- 一个简单客户端获取IP,国家,城市,省份的代码
<html><head> <script src="js/jquery-1.6.2.min.js" type="text/javascri ...
- python的常见排序
在python程序中,我们往往自始至终都在与序列(列表.字典.元组)打交道,而最常用的操作就是对序列排序了.在此简单总结一下python中的排序. 基本排序方法 在python中,list对象具有 s ...
- ThreadPool(线程池)
WPF使用ThreadPool.QueueUserWorkItem线程池防界面假死 时间:2012-01-09 20:44来源:http://luacloud.com 作者:luacloud 点击:1 ...
- 51nod 1257 01分数规划/二分
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1257 1257 背包问题 V3 基准时间限制:3 秒 空间限制:1310 ...
- Https---SSL协议
ssl协议的起源和历史我就不再多说了,就是那个Netscape 网景公司开发的,它的作用主要是提供了一种安全传输方式,我们知道网上有很多的时候需要我们去输入用户名和密码,那么假设我们自己的电脑防病毒还 ...
- C++中内部类访问外部类的私有成员
首先,如果不知道什么是内部类InnerClass的话,就没必要往下看了. 尝试在C++中模仿apple objective-c 的Grand Dispatch简化多线程编程时,使用了boost::fu ...
- Hibernate(1)
一.什么是hibernate 1. hibernate是开源的轻量级框架,应用在javaee三层结构中 dao层框架,使用orm思想对数据库进行crud操作 2 .在dao层里面做对数据库crud操作 ...
- js改变select的选中项不触发select的change事件
// test var selectEl = document.querySelector('select') var buttonEl = document.querySelector('butto ...