1. 程式人生 > >mysql5.7和mysql5.6同在CentOS7.4安裝差異對比之5.6.40

mysql5.7和mysql5.6同在CentOS7.4安裝差異對比之5.6.40

mysql5.6

Mysql5.6.40

mkdir –p /var/lib/mysql/ rpm -qa|grep mariadb // 查詢出來已安裝的mariadb
rpm -e --nodeps 文件名 // 卸載mariadb,文件名為上述命令查詢出來的文件

yum -y install gcc gcc-c++ ncurses ncurses-devel cmake bison
5.6解壓改名
chmod -R 755 mysql/
chown -R lbd.lbd mysql/

lbd用戶默認已經創建

rm /etc/my.cnf
mkdir –p /var/lib/mysql/

./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/

vim /etc/my.cnf
[mysql]

設置mysql客戶端默認字符集

default-character-set=utf8

[mysqld]
skip-name-resolve
#設置3306端口
port = 3306

設置mysql的安裝目錄

basedir=/usr/local/mysql

設置mysql數據庫的數據的存放目錄

datadir=/usr/local/mysql/data

允許最大連接數

max_connections=200

服務端使用的字符集默認為8比特編碼的latin1字符集

character-set-server=utf8

創建新表時將使用的默認存儲引擎

default-storage-engine=INNODB

max_allowed_packet=16M

cp support-files/mysql.server /etc/init.d/mysqld

cd /usr/local
vim /etc/init.d/mysqld

basedir=/usr/local/mysql
datadir=/usr/local/mysql/bin
屏蔽
#lockdir=‘/var/lock/subsys‘
#lock_file_path="$lockdir/mysql"

chown -R lbd.lbd mysql/
service mysqld start
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
chkconfig --add mysqld #增加mysqld服務

chkconfig --list #列出所有的系統服務
chkconfig --level 35 mysqld on
#設定mysqld在等級3和5為開機運行服務
mysql –u root –p
5.6初始沒密碼

grant all privileges on . to ‘root‘@‘%‘ identified by ‘lbd123‘;

FLUSH PRIVILEGES;

mysql5.7和mysql5.6同在CentOS7.4安裝差異對比之5.6.40