# 解壓
tar -xvf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz
mv /usr/local/mysql-5.7.22-linux-glibc2.12-x86_64 /usr/local/mysql
mkdir /usr/local/mysql/data
# mysql使用者組
groupadd mysql
# mysql使用者
useradd mysql -g mysql
chown -r mysql.mysql /usr/local/mysql
/usr/local/mysql/bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data
如果出現以下錯誤:
2018-07-14 06:40:32 [warning] mysql_install_db is deprecated. please consider switching to mysqld --initialize2018-07-14 06:40:32 [error] child process: /usr/local/mysql/bin/mysqldterminated prematurely with errno= 32
2018-07-14 06:40:32 [error] failed to execute /usr/local/mysql/bin/mysqld --bootstrap --datadir=/usr/local/mysql/data --lc-messages-dir=/usr/local/mysql/share --lc-messages=en_us --basedir=/usr/local/mysql
則使用以下命令(記得把上面命令生成的data檔案內容刪掉):/usr/local/mysql/bin/mysqld --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data --initialize
如果出現以下錯誤:
/usr/local/mysql/bin/mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: no such file or directory則執行以下命令:
yum -y install numactl
完成後重複上個步驟,繼續安裝(同樣把上面data檔案內容刪掉):
[mysqld]datadir=/usr/local/mysql/data
basedir=/usr/local/mysql
socket=/tmp/mysql.sock
user=mysql
port=3306character-set-server=utf8
# 取消密碼驗證
skip-grant-tables
# disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0# skip-grant-tables
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
# 將mysql加入服務
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
# 開機自啟
chkconfig mysql on
# 開啟
service mysql start
(有時候回報如下錯誤:
1.service mysql start;
報錯:mysql is neither service nor target!?
2.systemctl start mysql:
報錯:sysemctl start mysql : failed to star mysql.service: unit mysql.service failed to load: no such file ....)
解決方案:依次執行下面命令
systemctl unmask mysql.service
service mysql start
# 登入(由於/etc/my.cnf中設定了取消密碼驗證,所以此處密碼任意)
/usr/local/mysql/bin/mysql -u root -p
# 操作mysql資料庫
>>use mysql;
# 修改密碼
>>update user set authentication_string=password('你的密碼') where user='root';
>>flush privileges;
>>exit;
/usr/local/mysql/bin/mysql -u root -p
>>alter user 'root'@'localhost' identified by '修改後的密碼';
>>exit;
/usr/local/mysql/bin/mysql -u root -p
>>use mysql;
>>update user set host='%' where user = 'root';
>>flush privileges;
>>eixt;
如果不行,直接關掉linux的防火牆。
systemctl disable firewalld
這樣還不行的話,檢查伺服器入棧入棧規則。
ln -s /usr/local/mysql/bin/mysql /usr/bin
Linux下手動安裝screen
簡單說來就是自己用screen原始碼編譯安裝 now please check the pathnames in the makefile and inthe user configuration section in config.h.then type make to make screen.g...
linux下手動安裝apache
下面是官方文件的要求,必須安裝apr apr util pcre,gcc c 等包,文件url位址 所以,沒有這些支援的需要提前安裝好不然會出現個各種錯誤。tar zxvf apr util 1.6.1.tar.gz cd apr util 1.6.1 configure prefix usr lo...
linux下手動安裝nginx
yum install y gcc c yum install y pcre pcre devel yum install y zlib zlib devel yum install y openssl openssl devel linux系統不同可能這些命令會有所差異。因為配置不高,也沒伺服器,...