Centos7 - mysql 5.5.62 tar.gz 方式安装
安裝準備
Mariadb 去除
由于CentOS7自帶的是?Mariadb, 所以先來刪除他吧...
1. 查找版本
# rpm -qa|grep mariadb執(zhí)行命令后會出現(xiàn)類似 MariaDB-server-5.5.49-1.el7.centos.x86_64 之類的鬼..記住名字就行了.
2. 刪除
# rpm -e --nodeps 上面查出來的文件名3. 刪除配置文件
# rm /etc/my.cnf安裝包獲取
在官方直接找吧 MySQL Community Server 5.5.62
選擇?Linux - Generic 注意
推送壓縮包
推送到虛擬機或者遠程服務器, ftp 或者? rz, 或者直接圖形界面拖動隨你, 總之推上去就行了
開始安裝
解壓
解壓中注意如果出現(xiàn)EOF 報錯之類的需要考慮是否壓縮包文件損壞
嘗試更換壓縮包或者重新推送壓縮包
tar -xvf mysql-5.5.62-linux-glibc2.12-x86_64.tar.gz復制到 local?
mv mysql-5.5.62-linux-glibc2.12-x86_64 /usr/local修改文件夾
cd /usr/local mv mysql-5.5.62-linux-glibc2.12-x86_64 mysql-5.5.62?修改配置文件
vi /etc/my.cnf [mysql] # 設(shè)置mysql客戶端默認字符集 default-character-set=utf8 socket=/var/lib/mysql/mysql.sock[mysqld] skip-name-resolve #設(shè)置3306端口 port = 3306 socket=/var/lib/mysql/mysql.sock # 設(shè)置mysql的安裝目錄, 這里的目錄一定要是你解壓后并且改了名的目錄喲..basedir=/usr/local/mysql-5.5.62 # 設(shè)置mysql數(shù)據(jù)庫的數(shù)據(jù)的存放目錄, 這里的目錄一定要是你解壓后并且改了名的目錄喲..datadir=/usr/local/mysql-5.5.62/data# 允許最大連接數(shù) max_connections=200# 服務端使用的字符集默認為8比特編碼的latin1字符集 character-set-server=utf8# 創(chuàng)建新表時將使用的默認存儲引擎 default-storage-engine=INNODBlower_case_table_name=1 max_allowed_packet=16M切換目錄到mysql中
cd /usr/local/mysql-5.5.62添加用戶組與用戶
注意 : 這里需要將目錄切換到mysql目錄下 也就是上一步的操作
groupadd mysqluseradd -g mysql mysql
chown -R mysql:mysql ./
安裝mysql
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql-5.5.62/ --datadir=/usr/local/mysql-5.5.62/data/?安裝后會有如下的打印
[root@yangtuo mysql-5.5.62]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql-5.5.62/ --datadir=/usr/local/mysql-5.5.62/data/ Installing MySQL system tables... 190616 17:56:34 [Warning] Using unique option prefix lower_case_table_name instead of lower_case_table_names is deprecated and will be removed in a future release. Please use the full name instead. 190616 17:56:34 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 190616 17:56:34 [Note] /usr/local/mysql-5.5.62//bin/mysqld (mysqld 5.5.62) starting as process 73351 ... OK Filling help tables... 190616 17:56:34 [Warning] Using unique option prefix lower_case_table_name instead of lower_case_table_names is deprecated and will be removed in a future release. Please use the full name instead. 190616 17:56:34 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 190616 17:56:34 [Note] /usr/local/mysql-5.5.62//bin/mysqld (mysqld 5.5.62) starting as process 73359 ... OKTo start mysqld at boot time you have to copy support-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands:/usr/local/mysql-5.5.62//bin/mysqladmin -u root password 'new-password' /usr/local/mysql-5.5.62//bin/mysqladmin -u root -h 172.20.10.7 192.168.122.1 password 'new-password'Alternatively you can run: /usr/local/mysql-5.5.62//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 manual for more instructions.You can start the MySQL daemon with: cd /usr/local/mysql-5.5.62/ ; /usr/local/mysql-5.5.62//bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /usr/local/mysql-5.5.62//mysql-test ; perl mysql-test-run.pl Please report any problems at http://bugs.mysql.com/ [root@yangtuo mysql-5.5.62]#?以上到此已經(jīng)安裝成功了 mysql 還需要一些設(shè)置才可以正常運行
安裝配置
配置Mysql
chown -R mysql:mysql datachown 777 /etc.my.cnfcp ./support-files/mysql.server /etc/rc.d/init.d/mysqldchmod +x /etc/rc.d/init.d/mysqldchkconfig --add mysqldchkconfig --list mysqldmkdir /var/lib/mysqlchmod 777 /var/lib/mysql?
開啟服務
service mysqld start?
設(shè)置PATH
vi ~/.bash_profile?在文件最后面加入以下內(nèi)容,并使用:wq保存
export PATH=$PATH:/usr/local/mysql-5.5.62/bin刷新PATH
source ~/.bash_profile以上操作完成就既可以正常使用 mysql 了, 為了后期的方便使用, 我們還要進行一定的優(yōu)化設(shè)置已經(jīng)安全性設(shè)置等
mysql 基本使用及設(shè)置
登錄mysql
這時mysql沒有密碼, 當出現(xiàn)Enter password:時直接回車
mysql -uroot -p?
修改root密碼
mysql> use mysql mysql> update user set password=password('需要設(shè)置的密碼') where user='root' and host='localhost'; mysql> flush privileges;?
配置遠程登錄
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '剛才設(shè)置的root密碼' WITH GRANT OPTION;到此所有配置全部完畢. 可以使用遠程工具進行登錄了
?
轉(zhuǎn)載于:https://www.cnblogs.com/shijieli/p/11032499.html
總結(jié)
以上是生活随笔為你收集整理的Centos7 - mysql 5.5.62 tar.gz 方式安装的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 十三、StringBuffer
- 下一篇: [AWS vs Azure] 云计算里A