在linux系统中安装mysql服务器详细步骤并解决ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passw
来源:互联网 发布:手机图片编辑软件 编辑:程序博客网 时间:2024/06/05 06:45
1、首先下载MySQL的安装文件,我这里安装的是MySQL5.1.7版本的
2、查看linux系统中是否安装了mysql 执行:rpm -qa|grep -i mysql 如有会显示已安装的Mysql版本,我的显示mysql-libs-5.1.61-4.el6.i686
3、这时如果有的话就强制删除:rpm -e --nodeps mysql-libs-5.1.61-4.el6.i686(因为有包依赖,所以要强制删除)
在你没有强制删除时安装mysql
我的报错提示如下:
MySQL-server-5.1.7-0.i386.rpm
Preparing... ########################################### [100%]
file /usr/share/mysql/charsets/READMEfrom install of MySQL-server-5.1.7-0.i386.rpm conflicts with file frompackagemysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/Index.xmlfrom install of MySQL-server-5.1.7-0.i386.rpm conflicts with file frompackagemysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/armscii8.xmlfrom install of MySQL-server-5.1.7-0.i386.rpm conflicts with file frompackagemysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/ascii.xmlfrom install of MySQL-server-5.1.7-0.i386.rpm conflicts with file frompackagemysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/cp1250.xmlfrom install of MySQL-server-5.1.7-0.i386.rpm conflicts with file frompackagemysql-libs-5.1.61-4.el6.i686 。。。。。。
4、到mysql安装包路径下执行:rpm -ivh MySQL-server-5.1.7-0.i386.rpm 我这里安装成功了,但是mysql服务无法启动,总是启动失败,后来百度了一下,是因为selinux的原因,只要将selinux关闭就OK了。关闭selinux:vi /etc/selinux/config 将SELINUX=enforcing改成SELINUX=disabled然后重启
5、关闭selinux之后还是无法启动mysql服务,因为安装的mysql所有者是root,在安装mysql的时候会创建一个用户mysql,只要将/var/lib/mysql的所有者改为mysql就OK了,执行命令:chown -R mysql:mysql /var/lib/mysql
6、现在执行:service mysql start
7、安装MySQL客户端
执行命令rpm -ivhMySQL-client-5.1.7-0.i386.rpm进行安装。
8、安装成功
成功安装MySQL后将sql文件导入到数据库,步骤如下:
进入MYSQL Command Line Client
1、先创建数据库:create database test注:test是创建数据库的名称
2、再切换到当前数据库:use test
3、再输入:\. /root/test.sql或 souce /root/test.sql
按照以上步骤就可以将备份的sql脚本导入到linux中的数据库中去。
# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
使用网上介绍的方法修改root用户的密码:
# mysqladmin -uroot -p password 'newpassword'
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
现在终于被我找到了解决方法,如下(请先测试方法三,谢谢!):
方法一:
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysql restart
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>
mysql>
- 在linux系统中安装mysql服务器详细步骤并解决ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passw
- 在linux系统中安装mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passw
- linux安装MySQL出现ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
- 重置密码解决MySQL for Linux错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwor
- 重置密码解决MySQL for Linux错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwor
- ubuntu mysql问题 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YSE)解决
- mysql解决ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- 解决Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'(using password: YSE)
- 解决MySQL 报错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- mysql 错误解决 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
- 解决MySQL登录ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwor)问题
- 解决mysql登录出现ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YSE)
- 解决MySql登录错误ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- 解决MySQL登录ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwor)问题
- 解决MySQL登录ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwor)问题
- Mac下解决mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
- ubuntu 系统解决mysql连接问题(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO))
- ubuntu 系统解决mysql连接问题(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:
- Incorrect column specifier for column 'addressId'
- 2013年度总结
- MTK update account id
- 编程语言编年史
- 有向图强连通分量的Tarjan算法
- 在linux系统中安装mysql服务器详细步骤并解决ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passw
- 机房收费系统-数据库设计说明书
- 优化之drawcall
- 编写软件测试用例应注意的问题
- mtk上实现socket连接
- java.lang.ClassNotFoundException: javax.servlet.jsp.jstl.core.LoopTag
- 设计模式之迭代模式
- Android_实例_利用RadioButton实现分类筛选
- response,request理解