当前位置:Gxlcms >
数据库问题 >
Centos6.5 安装 MariaDB-10.0.20-linux-x86_64.tar.gz
Centos6.5 安装 MariaDB-10.0.20-linux-x86_64.tar.gz
时间:2021-07-01 10:21:17
帮助过:3人阅读
复制安装文件 /opt 目录下 并解压到当前目录 tar -zxf mariadb-10.0.20-linux-x86_64.tar.gz
把解压的文件名改为mariadb
groupadd mysql
useradd -g mysql mysql
cd /opt/mariadb
chown -R mysql:mysql /opt/mariadb/data
把mariadb/support-files下的my-medium.cnf复制到mariadb目录下,并改为my.cnf
./scripts/mysql_install_db --defaults-file=./my.cnf //初始化数据库
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod +x /etc/rc.d/init.d/mysqld
cp support-files/my-large.cnf /etc/my.cnf
修改 /etc/rc.d/init.d/mysqld
- basedir=/opt/mariadb
- datadir=/opt/mariadb/data
service mysqld start
修改环境变量 添加mariadb的bin目录 编辑/etc/profile,添加export PATH=$PATH:/opt/mariadb/bin/
修改root用户密码 ./bin/mysqladmin -u root password ‘123456‘
登录mysql ./bin/mysql -u root -p
设置数据库权限:
- MySQL [(none)]> use mysql;
- MySQL [mysql]> update user set host=‘%‘ where user=‘root‘ and host=‘127.0.0.1‘;
- MySQL [mysql]> grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘123456‘ with grant option;
- MySQL [mysql]> flush privileges;
Centos6.5 安装 MariaDB-10.0.20-linux-x86_64.tar.gz
标签: