安裝資料庫 linux 5 7

2021-08-28 13:11:54 字數 2940 閱讀 5716

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

linux安裝 重灌 MySQL5 7資料庫

ubuntu16.04徹底刪除mysql5.7 刪除mysql前 先刪除一下 var lib mysql 還有 etc mysql 若有資料請先自行備份 下面命令依次執行 sudo rm var lib mysql r 刪除資料庫目錄 sudo rm etc mysql r 刪除啟動指令碼 配置檔案...

linux安裝mysql資料庫(5 7之前的版本)

解壓32位安裝包 進入安裝包所在目錄,執行命令 tar mysql 5.6.17 linux glibc2.5 i686.tar.gz 複製解壓後的mysql目錄到系統的本地軟體目錄 執行命令 cp mysql 5.6.17 linux glibc2.5 i686 usr local mysql r...

linux安裝MySql資料庫5 7版本

2 安裝yum庫 shell yum localinstall y mysql57 community release el7 7.noarch.rpm 3 安裝資料庫 shell yum install y mysql community server 4 啟動mysql服務 shell syst...