1
|
[root@bogon ~]# yum install cmake -y
|
1
2
3
4
5
|
[root@bogon ~]# groupadd -r mysql
[root@bogon ~]# mkdir -p /mydata/data
[root@bogon ~]# useradd -g mysql -r -s /sbin/nologin mysql
[root@bogon ~]# tar xf mariadb- 5.5 . 36 .tar.gz
[root@bogon ~]# cd mariadb- 5.5 . 36 /
|
1
|
[root@bogon mariadb- 5.5 . 36 ]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/mydata/data/ -DSYSCONFDIR=/etc -DWITH_INNOBASE_STORAGE_ENGINE= 1 -DWITH_ARCHIVE_STPRAGE_ENGINE= 1 -DWITH_BLACKHOLE_STORAGE_ENGINE= 1 -DWIYH_READLINE= 1 -DWIYH_SSL=system -DVITH_ZLIB=system -DWITH_LOBWRAP= 0 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
|
1
|
[root@bogon mariadb- 5.5 . 36 ]# make && make install
|
1
2
3
|
[root@bogon mysql]# cd /usr/local/mysql/
[root@bogon mysql]# chown mysql.root * -R
root@bogon scripts]# ./scripts/mysql_install_db --user=mysql --datadir=/mydata/data/
|
1
|
[root@bogon mysql]# cp support-files/my-large.cnf /etc/my.cnf
|
1
2
3
|
修改cp过去的文件
thread_concurrency = 2
datadir=/mydata/data
|
1
2
3
|
[root@bogon mysql]# mysqld --help --verbose |head - 20
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf
|
1
2
3
4
|
[root@bogon mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[root@bogon mysql]# vi /etc/init.d/mysqld
[root@bogon mysql]# chkconfig --add mysqld
[root@bogon mysql]# chkconfig mysqld on
|
1
2
|
MariaDB [(none)]> show global var iables\G;
MariaDB [(none)]> show session var iables\G;
|
1
2
3
4
|
MariaDB [mysql]> drop user '' @ 'localhost' ;
Query OK, 0 rows affected ( 0.00 sec)
MariaDB [mysql]> drop user '' @ 'bogon' ;
Query OK, 0 rows affected ( 0.00 sec)
|
1
2
3
4
5
6
7
8
9
10
|
第一种方法
MariaDB [mysql]> set password for 'root' @ 'localhost' =password( 'wangfeng7399' );
Query OK, 0 rows affected ( 0.00 sec)
第二张方法
MariaDB [mysql]> update user set password=password( 'wangfeng7399' )where user= 'root' and host= '127.0.0.1' ;
Query OK, 1 row affected ( 0.07 sec)
Rows matched: 1 Changed: 1 Warnings: 0
第三种方式
mysqladmin -u UserName -h Host password 'new_password' -p
mysqladmin -u UserName -h Host -p flush-privileges
|