標籤:fedora x86_64 rem 檢測 檢查 注意 top tor conf
1.1. 檢測是否已經安裝了mysql
rpm -qa | grep mysql
如果已經安裝了,將其卸載,如:
rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64
1.2. 安裝mysql
1、mkdir /usr/local/src/mysql
2、cd /usr/local/src/mysql
3、tar -xvf MySQL-5.6.22-1.el6.i686.rpm-bundle.tar(解壓)
4、安裝server
rpm -ivh MySQL-server-5.6.22-1.el6.i686.rpm
出錯:
安裝依賴:yum -y install libaio.so.1 libgcc_s.so.1 libstdc++.so.6
需要升級libstdc++-4.4.7-4.el6.x86_64
yum update libstdc++-4.4.7-4.el6.x86_64
5、安裝中:
6、安裝client
安裝依賴:yum -y install libncurses.so.5 libtinfo.so.5
7、查詢mysq服務運行狀態
服務未啟動。
8、 啟動mysql服務
service mysql start
9、使用root帳號登入mysql
提示:
在安裝mysql server時有句提示:
1、 注意:這個密碼是不安全的,所有需要修改初始密碼。
2、 使用密碼登入mysql帳號:mysql -uroot -p
3、 修改root密碼:SET PASSWORD = PASSWORD(‘123456‘);
2.3
系統啟動時自動啟動mysql服務
注意:
centos7開始使得以往老版本系統服務的/etc/init.d的啟動指令碼的方式就此改變,在centos7中所有對服務的管理都集中到了systemctl當中。
systemctl是一個系統管理守護進程、工具和庫的集合,用於取代以往的System V、service和chkconfig命令。
建立用於啟動MySQL的設定檔
[[email protected] ~]# touch /usr/lib/systemd/system/mysqld.service
[[email protected] ~]# cd /usr/lib/systemd/system
編輯mysqld.service檔案,加入如下內容:
[[email protected] system]# vi mysqld.service
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/opt/mysql-5.7.18/bin/mysqld --defaults-file=/etc/my.cnf
LimitNOFILE = 5000
儲存退出
備忘:ExecStart=/opt/mysql-5.7.18/bin/mysqld (此處請對應修改為MySQL程式所在的路徑)
尋找mysqld路徑,例如:
[[email protected] system]# which mysqld
/opt/mysql-5.7.18/bin/mysqld
通過systemctl方式啟動mysql5.7:
[[email protected] system]# systemctl start mysqld
檢查MySQL運行狀態:
[[email protected] system]# mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.18-log MySQL Community Server (GPL)
關閉防火牆:
[[email protected] system]# systemctl stop firewalld.service
[[email protected] system]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
設定mysql的開機啟動:
[[email protected] system]# systemctl enable mysqld
Created symlink from /etc/systemd/system/multi-user.target.wants/mysqld.service to /usr/lib/systemd/system/mysqld.service.
[[email protected] system]# systemctl list-unit-files | grep mysqld
mysqld.service enabled
取消mysql的開機自啟動:
[[email protected] system]# systemctl disable mysqld
Removed symlink /etc/systemd/system/multi-user.target.wants/mysqld.service.
[[email protected] system]# systemctl list-unit-files | grep mysqld
mysqld.service disabled
linux下安裝mysql