标签归档:mariadb

CentOS 7下yum安装MariaDB

CentOS 7下mysql下替换成MariaDB了。

把以下内容放到 /etc/yum.repos.d/MariaDB.repo 文件中

# MariaDB 10.4 CentOS repository list - created 2019-11-27 06:40 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

更多发行版:https://downloads.mariadb.org/mariadb/repositories/

安装

yum install mariadb mariadb-server
systemctl start mariadb   #启动mariadb
systemctl enable mariadb  #设置开机自启动
mysql_secure_installation #设置root密码等相关
mysql -uroot -p           #测试登录

linux中mariadb安装后phpmyadmin 无法连接的问题怎么解决

There are 2 ways to solve this:

  1. You can set the root user to use the mysql_native_password plugin
  2. You can create a new db_user with you system_user (recommended)

Option 1:

$ sudo mysql -u root # I had to use "sudo" since is new installation

mysql> USE mysql;
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit;

$ service mysql restart

Option 2: (replace YOUR_SYSTEM_USER with the username you have)

$ sudo mysql -u root # I had to use "sudo" since is new installation

mysql> USE mysql;
mysql> CREATE USER 'YOUR_SYSTEM_USER'@'localhost' IDENTIFIED BY '';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'YOUR_SYSTEM_USER'@'localhost';
mysql> UPDATE user SET plugin='auth_socket' WHERE User='YOUR_SYSTEM_USER';
mysql> FLUSH PRIVILEGES;
mysql> exit;

$ service mysql restart

账号初始化:

$ sudo mysql_secure_installation

默认root密码为空;然后设置root密码和其他选项:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

登陆MariaDB命令行:

$ sudo mysql -u root -p

自建 wnmp 运行环境

网盘下载:

链接: https://pan.baidu.com/s/1eR81ZCe 密码: zj68
解压后移动到 d:\wnmp 目录下,运行 service.bat(双击运行)。更多内容查看 readme.md

手动创建

环境:操作系统 win7,安装目录 d:\wnmp 。

nginx

1、下载 nginx,解压后改名到 d:\wnmp\nginx 目录下。
2、编辑 c:\wnmp\nginx\config\nginx.conf

解除以下行的注释:
#error_log  logs/error.log;
#pid        logs/nginx.pid;

在 http 块首添加以下行:
upstream php_processes {
    server 127.0.0.1:9000 weight=1;
}

在最后一个 server 块之后添加以下行:
server_names_hash_bucket_size 64; #server_name长度限制
server_names_hash_max_size 1024; #server_name条数限制
include ../../vhosts/*.conf;

php

1、下载 php,考虑到兼容性 和 运行模式,应该下载 x86 nts 版本。解压后改名到 d:\wnmp\php 目录下。
2、复制 d:\wnmp\php\php.ini-developmentd:\wnmp\php\php.ini,并编辑此文件:

生产环境请复制 php.ini-production

解除以下行的注释:
; extension_dir = "ext"
;cgi.fix_pathinfo=1
修改 cgi.fix_pathinfo 值
cgi.fix_pathinfo=0
其他配置根据需求自行配置

继续阅读