標籤:
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
[[email protected] etc]# service mysqld restart
3、登入資料庫重新設定root密碼
[[email protected] ~]# 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 命令列形式下一定要輸入";"
按照前面五個步驟完成之後,通過控制台輸入
[[email protected] ~]# 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地址,則能夠識別了
[[email protected] ~]# 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.
Linux 安裝MYSQL