Ubuntu下安裝Mysql 與Phpmyadmin

Ubuntu下安裝Mysqlphp

  1. sudo apt-get install mysql-servermysql

  2. sudo apt-get isntall mysql-clientsql

  3. sudo apt-get install libmysqlclient-devjson

安裝過程當中會出現提示設置root帳戶的用戶名以及密碼,按照提示來便可。輸入如下命令能夠查看mysql監聽端口來檢查MySQL是否安裝成功。sudo netstat -tap | grep mysqlubuntu

yang@yang-K45VD:~$ sudo netstat -tap | grep mysql
tcp        0      0 localhost:mysql         *:*                     LISTEN      6688/mysqld     
yang@yang-K45VD:~$ 

複製代碼

嘗試登陸mysqlmysql -u root -p 輸入密碼登陸瀏覽器

yang@yang-K45VD:~$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.7.19-0ubuntu0.16.04.1 (Ubuntu)

Copyright (c) 2000, 2017, 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.

mysql> 

複製代碼

此時已經能夠看到安裝並登陸成功了。bash

在 Linux 中可視化的 mysql 客戶端我選擇 phpmyadmin 下面介紹 phpmyadmin 的安裝以及配置服務器

安裝 phpmyadmintcp

sudo apt-get install phpmyadmin測試

須要注意的是,由於咱們已經安裝配置了 MySQL 因此在安裝的過程當中 phpmyadmin 詢問咱們是否自動生成 MySQL 配置時咱們通常選擇否。安裝完成後會在 /usr/share/ 下生成 phpmyadmin/ 目錄 咱們須要把這個文件複製一份到咱們的服務器的根目錄下(這裏我使用的是 Apache ) sudo cp -rf /usr/share/phpmyadmin/ 你本身的Apache服務器根目錄這裏還須要注意一下,此時直接訪問http://localhost/phpmyadmin/會報錯以下

The mbstring extension is missing.
複製代碼

由於缺乏了 php 的 mbstring 拓展,這裏我找到了一份解決方案,我測試是有效的。這裏是:解決方案 具體的配置文件位置可能會和你 php 的版本不一樣會有所差別,個人版本是 7.0 的版本 mods-available 的位置以下 /etc/php/7.0/mods-available 取消 json.ini 文件的 priority=20 前面的註釋(注意文件修改權限)。重啓 Apache 而後再在瀏覽器裏訪問 http://localhost/phpmyadmin/ 便可。

相關文章
相關標籤/搜索