wget
2、將mysql安裝到/usr/local/mysql下
tar -xvf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.7.22-linux-glibc2.12-x86_64 /usr/local/
mv /usr/local/mysql-5.7.22-linux-glibc2.12-x86_64 /usr/local/mysql
3、新建data目錄
mkdir /usr/local/mysql/data
4、新建mysql使用者、mysql使用者組
groupadd mysql
useradd mysql -g mysql
5、將/usr/local/mysql的所有者及所屬組改為mysql
chown -r mysql.mysql /usr/local/mysql
6、配置
/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 --initialize
2018-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
– server log begin –
– server log end –
複製**
/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
/usr/local/mysql/bin/mysqld --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data --initialize
在該檔案上新增上
[mysqld]
datadir=/usr/local/mysql/data
basedir=/usr/local/mysql
socket=/tmp/mysql.sock
user=mysql
port=3306
character-set-server=utf8
skip-grant-tables
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
7、開啟服務
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
chkconfig mysql on
service mysql start
8、設定密碼
/usr/local/mysql/bin/mysql -u root -p
use mysql;
update user set authentication_string=password(『密碼』) where user=『root』;
flush privileges;
exit;9、將/etc/my.cnf中的skip-grant-tables刪除
10、登入再次設定密碼(不知道為啥如果不再次設定密碼就操作不了資料庫了)
/usr/local/mysql/bin/mysql -u root -p
alter user 『root』@『localhost』 identified by 『密碼』;
exit;11、允許遠端連線
/usr/local/mysql/bin/mysql -u root -p
use mysql;
update user set host=』%』 where user = 『root』;
flush privileges;
eixt;12、新增快捷方式
ln -s /usr/local/mysql/bin/mysql /usr/bin
13、sqlyong進行連線
原始碼安裝MySQL 5 7
1 上傳安裝包wget2 新增系統mysql使用者和mysql組 useradd r g mysql mysql 新增mysql使用者 新增完成後可用id mysql檢視 groupadd mysql 新增mysql組3 解壓,把裡面裡面的東西放到 usr local mysql下 tar zxf ...
原始碼編譯安裝mysql 5 7
原始碼編譯安裝mysql 5.7.17 規劃 mydata data 資料目錄 邏輯卷 1 準備邏輯卷 2 解除安裝系統自帶的mariadb軟體 root mysqltest rpm qa grep mariadb mariadb libs 5.5.44 2.el7.centos.x86 64 ro...
MySQL57原始碼編譯安裝
wgetwget安裝相關依賴 yum install y git cmake gcc gcc c bison ncurses ncurses devel bison devel libaio devel建立工作目錄和資料目錄 我的資料盤是掛在 opt下的 mkdir p opt mysql mkdi...