標籤:
1.下載和解壓mysql資料庫 wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.11-linux-glibc2.5-x86_64.tar.gzs tar -xvf mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz -C /usr/local/mysql-5.7.11 2.建立軟連結ln -s mysql-5.7.11 mysql 3.建立mysql使用者和修改軟體的許可權 useradd -r -M -s /sbin/nologin mysql chown -R mysql.mysql /usr/local/mysql-5.7.11 chown -R mysql.mysql /usr/local/mysql chgrp -R mysql /usr/local/mysql-5.7.11 4.安裝和初始化資料庫 cd /usr/local/mysql-5.7.11/ bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql-5.7.11/ --datadir=/usr/local/mysql-5.7.11/data/ --必須在mysql根目錄安裝mysql,否則出錯 cp -a ./support-files/my-default.cnf /etc/my.cnf cp -a ./support-files/mysql.server /etc/init.d/mysqld 修改/etc/my.cnf basedir = /usr/local/mysql-5.7.11
datadir = /usr/local/mysql-5.7.11/data
port = 3306 #cd bin/ #./mysqld_safe --user=mysql & [[email protected] scripts]# /etc/init.d/mysqld restart Shutting down MySQL.. [ OK ] Starting MySQL... [ OK ] 關閉是 /etc/init.d/mysqld stop #開機啟動 chkconfig --level 35 mysqld on 5.初始化密碼 mysql5.7會產生一個初始化密碼,而在之前的版本首次登陸不需要登入。 shell> cat /root/.mysql_secret ./mysql -uroot -p SET PASSWORD = PASSWORD(‘root‘);flush privileges 開放存取權限
[[email protected]_199_194_centos bin]# mysql -uroot -proot
MySQL [(none)]> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘root‘ WITH GRANT OPTION;
MySQL [(none)]> flush privileges;
linux centos7安裝 mysql-5.7.11