mysql安裝和配置

2021-07-11 06:45:00 字數 3250 閱讀 5657

選擇source code

yum -y install  gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* make cmake

groupadd mysql

useradd -r -g mysql mysql

tar -zxvf mysql-5.6.20

.tar

.gzcd mysql-5.6.20

#預設情況下是安裝在/usr/local/mysql

cmake .

make && make install

cmake .

-dcmake_install_prefix=/usr/local

/mysql \

-dmysql_datadir=/usr/local

/mysql/data \

-dsysconfdir=/etc \

-dwith_myisam_storage_engine=1 \

-dwith_innobase_storage_engine=1 \

-dwith_memory_storage_engine=1 \

-dwith_readline=1 \

-dmysql_unix_addr=/var/lib

/mysql/mysql.sock \

-dmysql_tcp_port=3306 \

-denabled_local_infile=1 \

-dwith_partition_storage_engine=1 \

-dextra_charsets=all \

-ddefault_charset=utf8 \

-ddefault_collation=utf8_general_ci

編譯的引數可以參考

chown -r mysql.mysql /usr/local/mysql

cd /usr/local/mysql/scripts

./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

#註冊服務

cp mysql.server /etc/rc.d/init.d/mysql

#使用預設配置檔案

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

#讓chkconfig管理mysql服務

chkconfig --add mysql

#開機啟動

chkconfig mysql on

service mysql start

show

variables

like

'character%'

修改mysql的my.cnf檔案

[client]

default-character-set=utf8

[mysqld]

character-set-server=utf8

[mysql]

default-character-set=utf8

cd ~

#我把path新增到當前使用者目錄的bashrc中,如果需要全域性設定,請修改`/etc/profile`

vi .bashrc

#加入以下內容

path=/usr/local/mysql/bin:$path

export path

mysql -uroot  

setpassword = password('123456');

grant

allprivileges

on *.* to

'root'@'%'

identified

by'123456'

with

grant

option;

1、grant語句

格式:grant select on 資料庫.* to 使用者名稱@登入主機 identified by 「密碼」

說明:(1)grant all 賦予所有的許可權

(2)demo.* 資料庫 demo 中所有的表

(3)newuser 使用者名稱

(4)@localhost 在本地電腦上的 mysql server 伺服器

(5)identfified by 『password』 設定密碼

增加乙個使用者mysql密碼為mysql,讓他可以在任何主機上登入,並對所有資料庫有查詢、插入、修改、刪除的許可權。首先用以root使用者連入mysql,然後鍵入以下命令:

**如下

複製**

grant select,insert,update,delete on *.* to mysql@'%' identified by 'mysql'

mysql>grant all privileges on *.* to monty@localhost identified by 『password』 with grant option;

mysql>grant select,insert,update,delete,create,drop,alter on *.* to [email protected].% identified by 『password』;

2、檢視 mysql 使用者許可權

檢視當前使用者(自己)許可權:

show grants;

檢視其他 mysql 使用者許可權:

show grants for dba@localhost;

3、撤銷已經賦予給 mysql 使用者許可權的許可權。

revoke 跟 grant 的語法差不多,只需要把關鍵字 「to」 換成 「from」 即可:

grant  all on *.* to   dba@localhost;

revoke all on *.* from dba@localhost;

安裝和配置mysql

一直在用伺服器上的資料庫,現在重現回到本地資料庫,發現mysql和oracle已經解除安裝了,安裝oracle那就算了,先用乙個開源的mysql就總夠我用的了。let s go。我這裡是以解壓的來為例,這種比較常見。解壓之後可以將該資料夾改名,放到合適的位置,一般就是program files資料夾...

mysql 安裝和配置

mysql 安裝 在命令列輸入sudo apt get install mysql server 安裝過程中會跳出來乙個視窗,輸入資料庫root使用者的密碼 必須輸入密碼 安裝完成後 通過mysql uroot p然後輸入前面輸入的密碼,就可以進入到mysql資料環境 配置 mysql 的編碼 my...

MySql安裝和配置

官網 我們點選官網進入後點選 download 點選後頁面往下滑選擇 選擇 community server 接著點選 系統預設選中預設安裝,我們現在採用自定義安裝,選擇 custom 點選 next 後我們看到的左側列出的是產品列表,我們展開 mysql servers 選擇最裡面的選項,然後點選...