本文主要給大家介紹MySQL是如何創(chuàng)建并選擇數(shù)據(jù)庫(kù)的,文章內(nèi)容都是筆者用心摘選和編輯的,具有一定的針對(duì)性,對(duì)大家的參考意義還是比較大的,下面跟筆者一起了解下MySQL是如何創(chuàng)建并選擇數(shù)據(jù)庫(kù)的吧。
創(chuàng)新互聯(lián)是專業(yè)的懷遠(yuǎn)網(wǎng)站建設(shè)公司,懷遠(yuǎn)接單;提供網(wǎng)站制作、做網(wǎng)站,網(wǎng)頁(yè)設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行懷遠(yuǎn)網(wǎng)站開發(fā)網(wǎng)頁(yè)制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來(lái)合作!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ù)庫(kù)并 為你設(shè)置了權(quán)限,你可以使用它。否則,您需要自己創(chuàng)建數(shù)據(jù)庫(kù):
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ù)庫(kù)名稱是區(qū)分大小寫的(不像SQL關(guān)鍵字),所以你必須總是指到你的數(shù)據(jù)庫(kù) menagerie,而不是 Menagerie,MENAGERIE或一些其他變種。表名也是如此。(windows 下,大小寫不敏感,你最好使用與建表或者建庫(kù)時(shí)相同的拼寫。)
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)限。請(qǐng)與管理員討論,或參見第6.2節(jié)“MySQL訪問(wèn)特權(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ù)庫(kù)并沒有選擇使用它,你必須特別的指定,讓menagerie成為現(xiàn)在使用的數(shù)據(jù)庫(kù),使用以下語(yǔ)句:
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ù)庫(kù)只需要?jiǎng)?chuàng)建一次,但是每次開始mysql 會(huì)話時(shí)都必須選擇它。您可以通過(guò)發(fā)出USE如示例中所示的語(yǔ)句來(lái)執(zhí)行此操作 ?;蛘?,您可以在調(diào)用mysql時(shí)在命令行中選擇數(shù)據(jù)庫(kù)。只需在您可能需要提供的任何連接參數(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選項(xiàng)之后的命令行中提供密碼 ,你必須在-p選項(xiàng)后不插入空格馬上輸入(例如, -pmypassword 不是-p mypassword)。但是,不建議將密碼放在命令行上,因?yàn)檫@樣做會(huì)使其被登錄到您的計(jì)算機(jī)上的其他用戶窺探。
Note
You can see at any time which database is currently selected using SELECT DATABASE().
看完以上關(guān)于MySQL是如何創(chuàng)建并選擇數(shù)據(jù)庫(kù)的,很多讀者朋友肯定多少有一定的了解,如需獲取更多的行業(yè)知識(shí)信息 ,可以持續(xù)關(guān)注我們的行業(yè)資訊欄目的。
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。