mariadb数据库安装指南:https://downloads.mariadb.org/mariadb/repositories
一、ubuntu16.04 安装ubuntu的方法
Here are the commands to run to install MariaDB on your Ubuntu system:
1 2 3 |
sudo apt-get install software-properties-common sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirrors.tuna.tsinghua.edu.cn/mariadb/repo/10.2/ubuntu xenial main' |
Ubuntu无法找到add-apt-repository问题的解决方法
需要安装
1 2 |
apt-get install python-software-properties apt-get install software-properties-common |
Once the key is imported and the repository added you can install MariaDB with:
1 2 |
sudo apt update sudo apt install mariadb-server |
或者加入源直接安装
You can also create a custom MariaDB sources.list file. To do so, after importing the signing key as outlined above, copy and paste the following into a file under /etc/apt/sources.list.d/(we suggest naming the file MariaDB.list or something similar), or add it to the bottom of your /etc/apt/sources.list file.
1 2 3 4 |
# MariaDB 10.2 repository list - created 2017-09-04 09:41 UTC # http://downloads.mariadb.org/mariadb/repositories/ deb [arch=amd64,i386] http://mirrors.tuna.tsinghua.edu.cn/mariadb/repo/10.2/ubuntu xenial main deb-src http://mirrors.tuna.tsinghua.edu.cn/mariadb/repo/10.2/ubuntu xenial main |
Installing MariaDB .deb Files
https://mariadb.com/kb/en/the-mariadb-library/installing-mariadb-deb-files/
启动MariaDB服务:
1 2 |
sudo systemctl start mysql //启动mariadb sudo systemctl enable mysql //不需要 |
查看状态:
1 |
sudo systemctl status mysql |
接下来进行MariaDB的相关简单配置
1 |
mysql_secure_installation |
首先是设置密码,会提示先输入密码
Enter current password for root (enter for none):<–初次运行直接回车
设置密码
Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
New password: <– 设置root用户的密码
Re-enter new password: <– 再输入一次你设置的密码
其他配置
Remove anonymous users? [Y/n] <– 是否删除匿名用户,回车
Disallow root login remotely? [Y/n] <–是否禁止root远程登录,回车,
Remove test database and access to it? [Y/n] <– 是否删除test数据库,回车
Reload privilege tables now? [Y/n] <– 是否重新加载权限表,回车
初始化MariaDB完成,接下来测试登录
mysql -u root -p password 后面和mysql一样了
phpmyadmin登录不了mariadb,提示服务器没有响应(或本地服务器的套接字没有正确设置
要将 config.inc.php 中
$cfg[‘Servers’][$i][‘host’] = ’localhost’;
改成 $cfg[‘Servers’][$i][‘host’] = ‘127.0.0.1’;
还要添加(随意,可不加)
$cfg[‘Servers’][$i][‘hide_db’] = ‘information_schema’;//使用登陆后看不见information_schema数据库
$cfg[‘Servers’][$i][‘hide_db’] = ‘performance_schema’;//使用登陆后看不见performance_schema数据库
然后就可以登录phpmyadmin了
更多待涛哥实践总结
转载请注明:PHP笔记 » Mariadb最新版数据库单机版安装实践