Ubuntu下安装Mysqlphp
sudo apt-get install mysql-servermysql
sudo apt-get isntall mysql-clientsql
sudo apt-get install libmysqlclient-devjson
安装过程当中会出现提示设置root帐户的用户名以及密码,按照提示来便可。输入如下命令能够查看mysql监听端口来检查MySQL是否安装成功。sudo netstat -tap | grep mysql
ubuntu
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/
便可。