标签:
MySQL安装 转载 http://blog.csdn.net/horace20/article/details/26516689
1、首先我们需要从MySQL开发者网站下载Yum仓库文件,导入Yum库后,一个简单的yumupdate命令将确保你运行在MySQL5.6的最新发布版上,包括一些安全特性的更新。Yum同时也将确保导入相关依赖库,这些都将使我们的安装过程简单化。进入http://dev.mysql.com/downloads/repo/,下载RedHat Enterprise Linux 6 / Oracle Linux 6版。文件名称:mysql-community-release-el6-5.noarch.rpm
2、安装yum源
sudo yum localinstall mysql-community-release-el6-*.noarch.rpm
这个Yum库包含了MySQL Server,MySQL工作台管理工具以及ODBC驱动,现在可以通过下面的命令简单地安装MySQLServer:
3、sudo yum install mysql-community-server
至此我就可以使用Yum简单地管理MySQL更新,并能确保总是从官网软件库得到最新的发布版。
4、MySql 乱码 修改 /etc/my.cnf文件 character-set-server=utf8 , 表名不区分大小写:lower_case_table_names = 1.
service mysqld stop; service mysqld start; 如果启动失败,则可能是配置文件不对导致
MySQL安装后登陆错误 转载:http://blog.sina.com.cn/s/blog_8442befd01015zld.html
mysqladmin: connect to server at ‘localhost‘ failed error: ‘Access denied for user ‘root‘@‘localhost‘ (using password: YES)‘
1>停止mysql服务: service mysqld stop
2>执行命令:> mysqld_safe --skip-grant-tables & mysql -uroot -p 回车进入
> use mysql;
> update user set password=PASSWORD("newpass")where user="root";
更改密码为 newpass
> flush privileges; 更新权限
> quit 退出
3>重启mysql服务:service mysqld restart
4>链接数据库:mysql -uroot -p 新密码
二,忘记本地root的登录密码码
解决过程:
1、编辑/etc/my.cnf
在[mysqld] 配置部分添加一行
skip-grant-tables
2、保存后重启mysql
[root@localhost etc]# service mysqld restart
3、登录数据库重新设置root密码
[root@localhost ~]# mysql -uroot -p mysql
Enter password:
直接回车进入
mysql> show databases;
执行下列语句
mysql> update user set password=password("mysql") where user=‘root‘;
mysql> flush privileges;
4、删除/etc/my.cnf文件中添加的“skip-grant-tables”行,重启mysql;
用新设的密码就能正常登录了;
解决远程连接:http://hbiao68.iteye.com/blog/1989279
文章摘抄至
http://blog.csdn.net/hi_dyp/article/details/5556027
1、root用户登录到mysql数据库
/usr/local/mysql/bin/mysql -u root -p (输入密码进入mysql)
2、进入mysql,输入如下命令
use mysql;
3、查看user表的情况
SELECT Host,User FROM user;
//指明主机名称,“%”表示匹配所有字符串
4、 UPDATE user SET Host = ‘%‘ WHERE User= ‘root‘ LIMIT 1;
5、输入如下命令让刚才设置的命令生效
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
注意在mysql 命令行形式下一定要输入";"
按照前面五个步骤完成之后,通过控制台输入
[root@linux ~]# mysql -h localhost -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)
不让这么连接数据库
原因:是因为host对应的user字段是空的,我们需要将其改为root即可
mysql> select host,user from user;
+-----------+------+
| host | user |
+-----------+------+
| % | root |
| 127.0.0.1 | root |
| linux | |
| linux | root |
| localhost | |
+-----------+------+
5 rows in set (0.00 sec)
解决办法一:
mysql> update user set user=‘root‘ where host=‘localhost‘;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
解决办法二:
将localhost改为本机的IP地址,则能够识别了
[root@linux ~]# mysql -h 172.16.42.68 -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 157
Server version: 5.1.66 Source distribution
Copyright (c) 2000, 2012, 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.
标签:
原文地址:http://www.cnblogs.com/daxin/p/4744936.html