共計 679 個字符,預計需要花費 2 分鐘才能閱讀完成。
本篇內容主要講解“如何為 mysql 添加多用戶和數據庫”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓丸趣 TV 小編來帶大家學習“如何為 mysql 添加多用戶和數據庫”吧!
# vi mysqlusers.txt
create database dataname;
grant all privileges on dataname.* to username@localhost identified by lsquo;password lsquo;;
flush privileges;
# /usr/local/mysql/bin/mysql -u root -p password mysqlusers.txt
藍色斜體部分為對應的用戶名和密碼,添加多個用戶及,只需要復制中間部分代碼并修改對應的位置即可,如:
create database dataname1;
grant all privileges on dataname1.* to username1 @localhost”identified by lsquo;password lsquo;;
flush privileges;
create database dataname2;
grant all privileges on dataname2.* to username2 @localhost”identified by lsquo;password lsquo;;
flush privileges;
到此,相信大家對“如何為 mysql 添加多用戶和數據庫”有了更深的了解,不妨來實際操作一番吧!這里是丸趣 TV 網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!