經過XAMPP訪問phpmyadmin管理mysql數據庫

XAMPP(Apache+MySQL+PHP+PERL)是一個功能強大的建 XAMPP 軟件站集成軟件包,輕巧,用起來很方便。它提供了強大的phpmyadmin數據庫管理工具,讓使用者對數據庫的使用和管理駕輕就熟。對於不能在本地打開phpmyadmin的問題,個人解決方案以下:php

 

MySQL有一個默認的專用端口:3306,因此,若是你以前獨立安裝了MySQL,那麼3306端口已經被佔用。安裝XAMPP集成的MySQL時,必須從新設置獨立的端口,不然是不能訪問phpmyadmin的。mysql

 

修改方法也很方便,打開XAMPP的控制面板,找到mysql右側的config,點擊,會出現my.ini的選擇項,這個就是mysql的配置文件了。也能夠在XAMPP的安裝路徑下找:\xampp\mysql\bin\my.inisql

 

如圖中所示,將端口port改爲3307;固然只是修改端口,仍是訪問不了,還要去修改phpmyadmin的配置文件。數據庫

 

打開xampp目錄(找到xampp的安裝目錄),打開phpmyadmin的目錄,在該目錄下找到config.inc.php,即:\xampp\phpmyadmin\config.inc.php。apache

[php]  view plain  copy
 
  1. <?php  
  2. /* 
  3.  * This is needed for cookie based authentication to encrypt password in 
  4.  * cookie 
  5.  */  
  6. $cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */  
  7.   
  8. /* 
  9.  * Servers configuration 
  10.  */  
  11. $i = 0;  
  12.   
  13. /* 
  14.  * First server 
  15.  */  
  16. $i++;  
  17.   
  18. /* Authentication type and info */  
  19. $cfg['Servers'][$i]['auth_type'] = 'config';  
  20. $cfg['Servers'][$i]['user'] = 'username';            //mysql用戶名  
  21. $cfg['Servers'][$i]['password'] = 'password';       //mysql密碼  
  22. $cfg['Servers'][$i]['extension'] = 'mysqli';     //擴展配置,若訪問出現沒有配置mysqli等錯誤,加上這個。默認是有的  
  23. $cfg['Servers'][$i]['AllowNoPassword'] = true;  
  24. $cfg['Lang'] = '';  
  25.   
  26. /* Bind to the localhost ipv4 address and tcp */  
  27. $cfg['Servers'][$i]['host'] = '127.0.0.1';  
  28. $cfg['Servers'][$i]['connect_type'] = 'tcp';  
  29.   
  30. /* User for advanced features */  
  31. $cfg['Servers'][$i]['controluser'] = 'pma';  
  32. $cfg['Servers'][$i]['controlpass'] = '';  
  33.   
  34. /* Advanced phpMyAdmin features */  
  35. $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';  
  36. $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';  
  37. $cfg['Servers'][$i]['relation'] = 'pma_relation';  
  38. $cfg['Servers'][$i]['table_info'] = 'pma_table_info';  
  39. $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';  
  40. $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';  
  41. $cfg['Servers'][$i]['column_info'] = 'pma_column_info';  
  42. $cfg['Servers'][$i]['history'] = 'pma_history';  
  43. $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';  
  44. $cfg['Servers'][$i]['tracking'] = 'pma_tracking';  
  45. $cfg['Servers'][$i]['userconfig'] = 'pma_userconfig';  
  46. $cfg['Servers'][$i]['recent'] = 'pma_recent';  
  47. $cfg['Servers'][$i]['table_uiprefs'] = 'pma_table_uiprefs';  
  48.   
  49. /* 
  50.  * End of servers configuration 
  51.  */  
  52.   
  53. ?>  

 

 

而後在$cfg['Lang'] ="   "; 後加入如下代碼便可:cookie

 

[php]  view plain  copy
 
  1. $cfg['Servers'][$i]['port'] = '3307'  


保存文件,重啓apache,確保mysql打開,在地址欄輸入localhost/phpmyadmin,就能夠直接進入phpmyadmin的管理界面了,如圖所示:tcp

 

相關文章
相關標籤/搜索