mysql 零基礎安裝

2023-01-21 09:00:50 字數 2596 閱讀 3831

mysql安裝手冊

一:獲取mysql安裝包

二:安裝mysql

安裝依賴

執行  yum -y install perl perl-devel

後在初始化資料庫即可。

報錯如下:

fatal error: please install the following perl modules before executing /usr/bin/mysql_install_db:

data::dumper

在安裝以下命令即可

yum install -y perl-data-dumper

2,2、解壓

[[email protected] ~]# ls

anaconda-ks.cfg mysql-5.6.37-linux-glibc2.12-x86_64.tar.gz nginx-1.8.1 nginx-1.8.1.tar

.gz#解壓

[[email protected] ~]# tar -xf mysql-5.6.37-linux-glibc2.12-x86_64.tar

.gz

[[email protected] ~]# ls

anaconda-ks.cfg mysql-5.6.37-linux-glibc2.12-x86_64 mysql-5.6.37-linux-glibc2.12-x86_64.tar.gz nginx-1.8.1 nginx-1.8.1.tar

.gz#複製解壓後的mysql目錄到/usr/local/mysql

[[email protected] ~]# cp -r mysql-5.6.37-linux-glibc2.12-x86_64 /usr/local/mysql

2.3、新增使用者組和使用者

建立mysql所使用的使用者:

#新增使用者組

[[email protected] ~]# groupadd mysql

#新增使用者mysql 到使用者組mysql

[[email protected] ~]# useradd -g mysql mysql

2.4、安裝

#進入到mysql目錄

[[email protected] ~]# cd /usr/local/mysql/#建立mysql資料存放目錄

[[email protected] mysql]#

mkdir -p /data/mysq

#授予mysql的許可權

[[email protected] mysql]#

chown -r mysql:mysql ./[[email protected] mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/mysql

[[email protected] mysql]#

cp support-files/mysql.server /etc/init.d/mysqld

[[email protected] mysql]#

chmod

755 /etc/init.d/mysqld

[[email protected] mysql]#

cp support-files/my-default.cnf /etc/my.cnf

cp: overwrite ?.etc/my.cnf?. y

[[email protected] mysql]#

vi /etc/init.d/mysqld

#修改項

basedir=/usr/local/mysql/datadir=/usr/local/mysql/data/mysql

#啟動服務

[[email protected] mysql]# service mysqld start

starting mysql.logging to

'/usr/local/mysql/data/mysql/localhost.localdomain.err'.

success![[email protected] mysql]# service mysqld status

success! mysql running (63130

)[[email protected] mysql]#

#測試連線 :

[[email protected] mysql]# ./bin/mysql -u root

#加入環境變數,編輯 /etc/profile,這樣可以在任何地方用mysql命令了

[[email protected] mysql]# export path=$path:/usr/local/mysql/bin/[[email protected] mysql]# source /etc/profile

三:啟動

#啟動mysql

service mysqld start

#關閉mysql

service mysqld stop

#檢視執行狀態

service mysqld status

修改密碼

set password for [email protected] = password('

123');

零基礎學mysql 零基礎學MySQL(二)

mysql 基本語法 1建立資料庫 create database 資料庫名 其他選項 create database mytest character set gbk 這裡是建立了一個表 然後設定了這個表的編碼集 2 建立表 create table 表明 類 約束等 create table i...

零基礎安裝python的pip包

搞了很久,找了很多的教程,多數存在問題,結合幾個帖子,終於安裝好了。激動下,不容易啊,幾個小時。首先說一下,我的電腦系統是win10 64位,python34 第二步,按照下面這個教程,設定環境變數,只需要根據這個設定環境變數就可以了。第三步,按照這個帖子進行步驟1 3 註釋 安裝了幾次,在這個過程...

零基礎nvmw安裝教程(Windows)

參考安裝教程 git clone git homedrive homepath nvmw 輸入命令 nvmw 檢視是否配置成功,注意這裡輸入命令的時候,必須得重啟你的命令列終端,否則是不會生效的,下圖顯示的就是配置成功的輸出了 nvmw 雖然是安裝成功了,但是因為是國內,所有還需要手動配置幾個.nv...