010-LAMP_MySQL_other

010-LAMP_MySQL_other

MySQL的user表…

MariaDB [(none)]> DESC mysql.user;
+------------------------+-----------------------------------+------+-----+---------+-------+
| Field                  | Type                              | Null | Key | Default | Extra |
+------------------------+-----------------------------------+------+-----+---------+-------+
| Host                   | char(60)                          | NO   | PRI |         |       |
| User                   | char(16)                          | NO   | PRI |         |       |
| Password               | char(41)                          | NO   |     |         |       |
| Select_priv            | enum('N','Y')                     | NO   |     | N       |       |
| Insert_priv            | enum('N','Y')                     | NO   |     | N       |       |
| Update_priv            | enum('N','Y')                     | NO   |     | N       |       |
| Delete_priv            | enum('N','Y')                     | NO   |     | N       |       |
| Create_priv            | enum('N','Y')                     | NO   |     | N       |       |
| Drop_priv              | enum('N','Y')                     | NO   |     | N       |       |
| Reload_priv            | enum('N','Y')                     | NO   |     | N       |       |
| Shutdown_priv          | enum('N','Y')                     | NO   |     | N       |       |
| Process_priv           | enum('N','Y')                     | NO   |     | N       |       |
| File_priv              | enum('N','Y')                     | NO   |     | N       |       |
| Grant_priv             | enum('N','Y')                     | NO   |     | N       |       |
| References_priv        | enum('N','Y')                     | NO   |     | N       |       |
| Index_priv             | enum('N','Y')                     | NO   |     | N       |       |
| Alter_priv             | enum('N','Y')                     | NO   |     | N       |       |
| Show_db_priv           | enum('N','Y')                     | NO   |     | N       |       |
| Super_priv             | enum('N','Y')                     | NO   |     | N       |       |
| Create_tmp_table_priv  | enum('N','Y')                     | NO   |     | N       |       |
| Lock_tables_priv       | enum('N','Y')                     | NO   |     | N       |       |
| Execute_priv           | enum('N','Y')                     | NO   |     | N       |       |
| Repl_slave_priv        | enum('N','Y')                     | NO   |     | N       |       |
| Repl_client_priv       | enum('N','Y')                     | NO   |     | N       |       |
| Create_view_priv       | enum('N','Y')                     | NO   |     | N       |       |
| Show_view_priv         | enum('N','Y')                     | NO   |     | N       |       |
| Create_routine_priv    | enum('N','Y')                     | NO   |     | N       |       |
| Alter_routine_priv     | enum('N','Y')                     | NO   |     | N       |       |
| Create_user_priv       | enum('N','Y')                     | NO   |     | N       |       |
| Event_priv             | enum('N','Y')                     | NO   |     | N       |       |
| Trigger_priv           | enum('N','Y')                     | NO   |     | N       |       |
| Create_tablespace_priv | enum('N','Y')                     | NO   |     | N       |       |
| ssl_type               | enum('','ANY','X509','SPECIFIED') | NO   |     |         |       |
| ssl_cipher             | blob                              | NO   |     | NULL    |       |
| x509_issuer            | blob                              | NO   |     | NULL    |       |
| x509_subject           | blob                              | NO   |     | NULL    |       |
| max_questions          | int(11) unsigned                  | NO   |     | 0       |       |
| max_updates            | int(11) unsigned                  | NO   |     | 0       |       |
| max_connections        | int(11) unsigned                  | NO   |     | 0       |       |
| max_user_connections   | int(11)                           | NO   |     | 0       |       |
| plugin                 | char(64)                          | NO   |     |         |       |
| authentication_string  | text                              | NO   |     | NULL    |       |
+------------------------+-----------------------------------+------+-----+---------+-------+
MariaDB [(none)]> select Host,User,Password from mysql.user;
+-----------+------+----------+
| Host      | User | Password |
+-----------+------+----------+
| localhost | root |          |
| husa.hust | root |          |
| 127.0.0.1 | root |          |
| ::1       | root |          |
| localhost |      |          |
| husa.hust |      |          |
+-----------+------+----------+
6 rows in set (0.00 sec)

圖形管理組件

授權root用戶可以在所有IP端登陸

MariaDB [mysql]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root';
Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

GUI client

Navicat
Mysql-Front
SQLyog
ToadForMySQL

使用HeidiSQL遠程登錄數據庫結果:

別說,還真不錯…

phpMyAdmin

1 下載phpMyAdmin-4.0.5-all-languages.zip,並解壓之

[root@husa ~]# ls
99.sh            a.sh      latest.tar.gz         phpMyAdmin-4.0.5-all-languages      service.sh  wordpress-4.4.1.tar.gz
anaconda-ks.cfg  grub.bak  linux-3.10.67.tar.xz  phpMyAdmin-4.0.5-all-languages.zip  show.sh

2 複製phpMyAdmin-4.0.5-all-languages目錄至/var/www/html目錄

[root@husa ~]# cp -r phpMyAdmin-4.0.5-all-languages /var/www/html/
[root@husa ~]# ls /var/www/html/
index.php.bak  phpMyAdmin-4.0.5-all-languages  wordpress

3 修改pma配置文件


[root@husa ~]# cd /var/www/html/
[root@husa html]# ln -sv phpMyAdmin-4.0.5-all-languages pma
"pma" -> "phpMyAdmin-4.0.5-all-languages"
[root@husa html]# ls
index.php.bak  phpMyAdmin-4.0.5-all-languages  pma  wordpress


[root@husa ~]# openssl rand -base64 15
u9T2XpvocJvx3NyD/Yj9

[root@husa pma]# pwd
/var/www/html/pma


[root@husa pma]# cp config.sample.inc.php config.inc.php        
[root@husa pma]# vim config.inc.php 

# 修改下面的這個字段

$cfg['blowfish_secret'] = 'u9T2XpvocJvx3NyD/Yj9'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

4 啓動httpd

[root@husa pma]# systemctl start httpd
[root@husa pma]# ss -ntl
State      Recv-Q Send-Q                             Local Address:Port                               Peer Address:Port 
LISTEN     0      50                                             *:3306                                          *:*     
LISTEN     0      128                                            *:22                                            *:*     
LISTEN     0      100                                    127.0.0.1:25                                            *:*     
LISTEN     0      128                                           :::80                                           :::*     
LISTEN     0      128                                           :::22                                           :::*     
LISTEN     0      100                                          ::1:25                                           :::*     

5 訪問站點發現缺少mbstring(多字節字符串庫)

6 安裝之

[root@husa pma]# yum install php-mbstring

7 重啓httpd再次訪問,仍然不能訪問!

解決辦法Jerry Nettrouer II的回答:http://stackoverflow.com/questions/13357561/error-1045-cannot-log-in-to-mysql-server-phpmyadmin

8 也就是設置root用戶的密碼:這裏不是答案中的密碼,而是你自己給root設置的密碼,因爲一開始不知道,所以最後又一次的修改了密碼,修改方法如下:即修改mysql.user表中的root用戶的password字段。

MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [mysql]> update user set password=password('root') where user='root';
Query OK, 4 rows affected (0.05 sec)
Rows matched: 5  Changed: 4  Warnings: 0

MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

9 再次連接結果!

出現這種現象的原因是:If you are installing first time then please try login with username and password as root。也就是首次安裝mysql後要以root用戶登錄

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章