Centos6.5安装mariadb-10.2.12

创建mysql组和用户

[root@test local]# groupadd mysql
[root@test local]# useradd -g mysql mysql

解压/usr/local目录下的mariadb-10.2.12-linux-x86_64.tar.gz

[root@test local]# tar -zxvf mariadb-10.2.12-linux-x86_64.tar.gz

建立链接

[root@test local]# ln -s mariadb-10.2.12-linux-x86_64 mysql
[root@test local]# ls
bin  games    lib    libexec    mariadb-10.2.12-linux-x86_64.tar.gz  sbin   src    etc  include  lib64  mariadb-10.2.12-linux-x86_64  mysql    share

将/usr/local/mysql/support-files目录下的my-large.cnf拷贝到/etc目录下

[root@test support-files]# cp my-large.cnf /etc/my.cnf
cp:是否覆盖"/etc/my.cnf"? y

安装

[root@test mysql]# ./scripts/mysql_install_db --user=mysql
Installing MariaDB/MySQL system tables in './data' ...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

'./bin/mysqladmin' -u root password 'new-password'
'./bin/mysqladmin' -u root -h test password 'new-password'

Alternatively you can run:
'./bin/mysql_secure_installation'

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.

You can start the MariaDB daemon with:
cd '.' ; ./bin/mysqld_safe --datadir='./data'

You can test the MariaDB daemon with mysql-test-run.pl
cd './mysql-test' ; perl mysql-test-run.pl

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/

如果出现下列错误

[root@test mysql]# ./scripts/mysql_install_db --user=mysql
Installing MariaDB/MySQL system tables in './data' ...
./bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

Installation of system tables failed!  Examine the logs in
./data for more information.

The problem could be conflicting information in an external
my.cnf files. You can ignore these by doing:

    shell> ./scripts/mysql_install_db --defaults-file=~/.my.cnf

You can also try to start the mysqld daemon with:

    shell> ./bin/mysqld --skip-grant --general-log &

and use the command line tool ./bin/mysql
to connect to the mysql database and look at the grant tables:

    shell> ./bin/mysql -u root mysql
    mysql> show tables;

Try 'mysqld --help' if you have problems with paths.  Using
--general-log gives you a log in ./data that may be helpful.

The latest information about mysql_install_db is available at
https://mariadb.com/kb/en/installing-system-tables-mysql_install_db
MariaDB is hosted on launchpad; You can find the latest source and
email lists at http://launchpad.net/maria

Please check all of the above before submitting a bug report
at http://mariadb.org/jira

需安装libaio

[root@test mysql]# yum install -y libaio

修改目录所属者

[root@test mysql]# chown -R root .
[root@test mysql]# chown -R mysql data

启动

[root@test mysql]# ./bin/mysqld_safe --user=mysql
180114 14:00:04 mysqld_safe Logging to '/usr/local/mysql/data/test.err'.
180114 14:00:04 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

添加环境变量

export PATH=$PATH:/usr/local/mysql/bin/

登陆数据库更改root密码

MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [mysql]> UPDATE user SET password=password('1234qwer') WHERE user='root';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4  Changed: 4  Warnings: 0

MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> exit;
Bye

猜你喜欢

转载自blog.csdn.net/extremebingo/article/details/79059541