本文主要給大家介紹MySQL是如何創(chuàng)建并選擇數(shù)據(jù)庫的,文章內(nèi)容都是筆者用心摘選和編輯的,具有一定的針對性,對大家的參考意義還是比較大的,下面跟筆者一起了解下MySQL是如何創(chuàng)建并選擇數(shù)據(jù)庫的吧。

If the administrator creates your database for you when setting up your permissions, you can begin using it. Otherwise, you need to create it yourself:
如果管理員為你創(chuàng)建數(shù)據(jù)庫并 為你設(shè)置了權(quán)限,你可以使用它。否則,您需要自己創(chuàng)建數(shù)據(jù)庫:
mysql> CREATE DATABASE menagerie;
Under Unix, database names are case sensitive (unlike SQL keywords), so you must always refer to your database as menagerie, not as Menagerie, MENAGERIE, or some other variant. This is also true for table names. (Under Windows, this restriction does not apply, although you must refer to databases and tables using the same lettercase throughout a given query. However, for a variety of reasons, the recommended best practice is always to use the same lettercase that was used when the database was created.)
在Unix下,數(shù)據(jù)庫名稱是區(qū)分大小寫的(不像SQL關(guān)鍵字),所以你必須總是指到你的數(shù)據(jù)庫 menagerie,而不是 Menagerie,MENAGERIE或一些其他變種。表名也是如此。(windows 下,大小寫不敏感,你最好使用與建表或者建庫時相同的拼寫。)
Note
If you get an error such as ERROR 1044 (42000): Access denied for user 'micah'@'localhost' to database 'menagerie' when attempting to create a database, this means that your user account does not have the necessary privileges to do so. Discuss this with the administrator or see Section 6.2, “The MySQL Access Privilege System”.
注意
如果您收到 ERROR 1044 (42000): Access denied for user 'micah'@'localhost' to database 'menagerie',這意味著您的用戶帳戶沒有鎖必須的權(quán)限。請與管理員討論,或參見第6.2節(jié)“MySQL訪問特權(quán)系統(tǒng)”。
Creating a database does not select it for use; you must do that explicitly. To make menagerie the current database, use this statement:
創(chuàng)建數(shù)據(jù)庫并沒有選擇使用它,你必須特別的指定,讓menagerie成為現(xiàn)在使用的數(shù)據(jù)庫,使用以下語句:
mysql> USE menagerie Database changed
Your database needs to be created only once, but you must select it for use each time you begin a mysql session. You can do this by issuing a USE statement as shown in the example. Alternatively, you can select the database on the command line when you invoke mysql. Just specify its name after any connection parameters that you might need to provide. For example:
您的數(shù)據(jù)庫只需要創(chuàng)建一次,但是每次開始mysql 會話時都必須選擇它。您可以通過發(fā)出USE如示例中所示的語句來執(zhí)行此操作 。或者,您可以在調(diào)用mysql時在命令行中選擇數(shù)據(jù)庫。只需在您可能需要提供的任何連接參數(shù)之后指定其名稱。例如:
shell> mysql -h host -u user -p menagerie Enter password: ********
Important
menagerie in the command just shown is not your password. If you want to supply your password on the command line after the -p option, you must do so with no intervening space (for example, as -pmypassword, not as -p mypassword). However, putting your password on the command line is not recommended, because doing so exposes it to snooping by other users logged in on your machine.
重要
在剛剛的命令中 menagerie不是你的密碼。如果要在-p選項之后的命令行中提供密碼 ,你必須在-p選項后不插入空格馬上輸入(例如, -pmypassword 不是-p mypassword)。但是,不建議將密碼放在命令行上,因為這樣做會使其被登錄到您的計算機上的其他用戶窺探。
Note
You can see at any time which database is currently selected using SELECT DATABASE().
看完以上關(guān)于MySQL是如何創(chuàng)建并選擇數(shù)據(jù)庫的,很多讀者朋友肯定多少有一定的了解,如需獲取更多的行業(yè)知識信息 ,可以持續(xù)關(guān)注我們的行業(yè)資訊欄目的。
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
分享文章:MySQL是如何創(chuàng)建并選擇數(shù)據(jù)庫的-創(chuàng)新互聯(lián)
網(wǎng)頁地址:http://chinadenli.net/article10/hhjdo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站建設(shè)、網(wǎng)站制作、定制網(wǎng)站、自適應(yīng)網(wǎng)站、標(biāo)簽優(yōu)化、網(wǎng)站設(shè)計公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)