# Check if user isroot if [ $(id -u) !="0" ]; then echo "Error: You must be root to runthis script, please use root to install" exit 1 fi
clear echo"=========================================================================" echo "A tool toauto-compile & install MariaDB-10.1.16 on RedHat/CentOS Linux " echo"=========================================================================" cur_dir=$(pwd)
#set mysql rootpassword echo"==========================="
mysqlrootpwd="MANAGER" echo -e "Please input the root password of mysql:" read -p "(Default password: MANAGER):" mysqlrootpwd if[ "$mysqlrootpwd" = "" ]; then mysqlrootpwd="MANAGER" fi echo"===========================" echo"MySQL root password:$mysqlrootpwd" echo"==========================="
#which MySQL Versiondo you want to install? echo"==========================="
if [ -s/usr/local/mysql/bin/mysql ] && [ -s /usr/local/mysql/bin/mysqld_safe ]&& [ -s /etc/my.cnf ]; then echo "MySQL: OK" ismysql="ok" else echo "Error: /usr/local/mysql notfound!!!MySQL install failed." fi
if ["$ismysql" = "ok" ]; then echo "MariaDB 10.1.16 completed! enjoy it." echo"=========================================================================" netstat -ntl else echo"Sorry,Failed to install MySQL!" echo "You cantail /root/mysql-install.log from your server." fi }
#The installationlog InitInstall2>&1 | tee /root/mysql-install.log CheckAndDownloadFiles2>&1 | tee -a /root/mysql-install.log InstallDependsAndOpt2>&1 | tee -a /root/mysql-install.log InstallMySQL562>&1 | tee -a /root/mysql-install.log CheckInstall2>&1 | tee -a /root/mysql-install.log[root@HE3 ~]# mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or g. Your MariaDB connection id is 6 Server version: 10.1.16-MariaDB MariaDB Server Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type "help;" or "h" for help. Type "c" to clear the current input statement. MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.00 sec)至此,mariadb-10.1.16安装成功Linux系统教程:如何检查MariaDB服务端版本 http://www.linuxidc.com/Linux/2015-08/122382.htmMariaDB Proxy读写分离的实现 http://www.linuxidc.com/Linux/2014-05/101306.htmLinux下编译安装配置MariaDB数据库的方法 http://www.linuxidc.com/Linux/2014-11/109049.htmCentOS系统使用yum安装MariaDB数据库 http://www.linuxidc.com/Linux/2014-11/109048.htm安装MariaDB与MySQL并存 http://www.linuxidc.com/Linux/2014-11/109047.htmUbuntu 上如何将 MySQL 5.5 数据库迁移到 MariaDB 10 http://www.linuxidc.com/Linux/2014-11/109471.htm[翻译]Ubuntu 14.04 (Trusty) Server 安装 MariaDB http://www.linuxidc.com/Linux/2014-12/110048htmMariaDB 的详细介绍:请点这里 MariaDB 的下载地址:请点这里本文永久更新链接地址