时间:2021-07-01 10:21:17 帮助过:8人阅读
最近开始学习重新整理一遍MySQL的相关知识,以前总是零零散散的学习,现在重新整理一遍,文章当做自己的笔记
Distribution : CentOS 6.5 minimal
MySQL version : 5.5.36
Init system : sysvinit
1、添加用户组
useradd -r mysql
groupadd -r mysql
mkdir -p /mydata/data
chown -R mysql.mysql /mydata/data/
之所以安装了openssl-devel是因为下面开启了ssl验证,不安装的话编译不通过,其余的包是官方给出所需要最少需要的包,这里全部安装上
yum install gcc gcc-c++ cmake ncurses-devel openssl-devel bison-devel
wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.36.tar.gz
#wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.16.tar.gz
tar zxf mysql-5.5.36.tar.gz
cd mysql-5.5.36
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql /
-DMYSQL_DATADIR=/mydata/data /
-DSYSCONFDIR=/etc /
-DWITH_INNOBASE_STORAGE_ENGINE=1 /
-DWITH_ARCHIVE_STORAGE_ENGINE=1 /
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 /
-DWITH_READLINE=1 /
-DWITH_SSL=system /
-DWITH_ZLIB=system /
-DWITH_LIBWRAP=0 /
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock /
-DDEFAULT_CHARSET=utf8 /
-DDEFAULT_COLLATION=utf8_general_ci
make
make install
chown -R .mysql /usr/local/mysql/
cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf
在[mysql]中加入
datadir = /mydata/data
/usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/mydata/data/
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
/etc/init.d/mysqld start
vim /etc/profile.d/mysql.sh
export PATH=/usr/local/mysql/bin:$PATH source /etc/profile.d/mysql.sh
删除匿名用户
mysql> drop user ''@localhost;
mysql> drop user ''@node128; //这里我的测试机hostname
mysql> drop user root@'::1';
修改root密码
mysql> update user set password=PASSWORD('********') where user='root';
mysql> flush privileges; mysql> /q
安装完成之后下面开始从基本的一些之前一些学习的总结