下载地址:
http://mirrors.ustc.edu.cn/mariadb/mariadb-10.0.19/source/mariadb-10.0.19.tar.gz
因为用cmake所以线安装下这个 可以
yum install cmake
下载了tar.gz文件解压到指定的目录tar -zxvf XXX.tar.gz
进入到安装目录
[hcr@localhostmariadb-10.0.19]$ pwd
/app/mysql/mariadb-10.0.19
//创建下用户 分组,需要安装的目录,和数据库目录
[hcr@localhostmariadb-10.0.19]$ sudo groupadd mysql
[sudo] password forhcr:
[hcr@localhostmariadb-10.0.19]$ sudo useradd -g mysql mysql -s /bin/false
[hcr@localhostmariadb-10.0.19]$ mkdir -p /app/data/mysql
[hcr@localhostmariadb-10.0.19]$ sudo chown -R mysql:mysql /app/data/mysql/
[hcr@localhostmariadb-10.0.19]$ mkdir /app/local/mysql
cmake. -DCMAKE_INSTALL_PREFIX=/app/local/mysql-DMYSQL_DATADIR=/app/data/mysql/ -DSYSCONFDIR=/etc
这儿可能会碰到 缺少ncurses(报Curseslibrary not found异常)的问题,可以安装下,
yum installncurses-devel 或者现在rpm 指定安装
[hcr@localhostmariadb-10.0.19]$ make
//此处有点慢,我去坑爹阿,太长时间了等把,早知道应该选择
[hcr@localhostmariadb-10.0.19]$ make install
//一堆的installing
[hcr@localhostmariadb-10.0.19]$ cd /app/local/mysql/
[hcr@localhostmysql]$ sudo cp support-files/my-huge.cnf /etc/my.cnf
[hcr@localhostmysql]$ sudo vi /etc/my.cnf //编辑配置文件,在[mysqld]部分增加 datadir= /app/data/mysql //添加MariaDB数据库路径
datadir =/app/data/mysql
[hcr@localhostmysql]$ sudo cp support-files/my-huge.cnf /etc/my.cnf
[hcr@localhostmysql]$ sudo cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
[hcr@localhostmysql]$ sudo chmod 755 /etc/init.d/mysqld
[hcr@localhostmysql]$ sudo chkconfig mysqld on
[hcr@localhostmysql]$ sudo vi /etc/rc.d/init.d/mysqld
这个地方默认是
basedir=
datadir=
改成
basedir =/app/local/mysql #MariaDB程序安装路径
datadir= /app/data/mysql #MariaDB数据库存放目录
//服务启动
[hcr@localhostmysql]$ sudo service mysqld start
Starting MySQL.SUCCESS!
//配置到环境中
[hcr@localhostmysql]$ sudo vi /etc/profile //增加了一个环境变量
exportPATH=$PATH:/app/local/mysql/bin
到这儿重起下机器
[hcr@localhostmysql]$ sudo shutdown -r now
初始化mysqlroot密码
[root@localhost ~]#mysql_secure_installation
NOTE: RUNNING ALLPARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS INPRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log intoMariaDB to secure it, we'll need the current
password for theroot user. If you've just installed MariaDB, and
you haven't set theroot password yet, the password will be blank,
so you should justpress enter here.
Enter currentpassword for root (enter for none):
ERROR 1045 (28000):Access denied for user 'root'@'localhost' (using password: YES)
Enter currentpassword for root (enter for none):
ERROR 1045 (28000):Access denied for user 'root'@'localhost' (using password: YES)
//初始化直接enter就好了
Enter currentpassword for root (enter for none):
OK, successfullyused password, moving on...
Setting the rootpassword ensures that nobody can log into the MariaDB
root user withoutthe proper authorisation.
Set root password?[Y/n] y
New password:
Re-enter newpassword:
Password updatedsuccessfully!
Reloading privilegetables..
... Success!
By default, aMariaDB installation has an anonymous user, allowing anyone
to log into MariaDBwithout having to have a user account created for
them. This isintended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
productionenvironment.
Remove anonymoususers? [Y/n] y
... Success!
Normally, rootshould only be allowed to conn