MYSQL命令行模式管理MySql的一点心得_MySQL
MySql数据库是中小型网站后台数据库的首选,因为它对非商业应用是免费的.网站开发者可以搭建一个"Linux+Apache+PHP+MySql"平台,这是一个最省钱的高效平台.在使用MySql进行开发时,MySql自带的文档对于新手来说是份很好的参考资料.本文是我在使用MySql中的小小心得。
当前一般用户的开发环境多是Windows或Linux,用户可以到http://www.codepub.com/software/index.html下载相关版本进行安装,在windows中MySql以服务形式存在,在使用前应确保此服务已经启动,未启动可用netstartmysql命令启动。而Linux中启动时可用“/etc/rc.d/init.d/mysqldstart"命令,注意启动者应具有管理员权限。
刚安装好的MySql包含一个含空密码的root帐户和一个匿名帐户,这是很大的安全隐患,对于一些重要的应用我们应将安全性尽可能提高,在这里应把匿名帐户删除、root帐户设置密码,可用如下命令进行:
usemysql;
deletefromUserwhereUser="";
updateUsersetPassword=PASSWORD('newpassword')whereUser='root';
如果要对用户所用的登录终端进行限制,可以更新User表中相应用户的Host字段,在进行了以上更改后应重新启动数据库服务,此时登录时可用如下类似命令:
mysql-uroot-p;
mysql-uroot-pnewpassword;
mysqlmydb-uroot-p;
mysqlmydb-uroot-pnewpassword;
上面命令参数是常用参数的一部分,详细情况可参考文档。此处的mydb是要登录的数据库的名称。
在进行开发和实际应用中,用户不应该只用root用户进行连接数据库,虽然使用root用户进行测试时很方便,但会给系统带来重大安全隐患,也不利于管理技术的提高。我们给一个应用中使用的用户赋予最恰当的数据库权限。如一个只进行数据插入的用户不应赋予其删除数据的权限。MySql的用户管理是通过User表来实现的,添加新用户常用的方法有两个,一是在User表插入相应的数据行,同时设置相应的权限;二是通过GRANT命令创建具有某种权限的用户。其中GRANT的常用用法如下:
grantallonmydb.*toNewUserName@HostNameidentifiedby"password";
grantusageon*.*toNewUserName@HostNameidentifiedby"password";
grantselect,insert,updateonmydb.*toNewUserName@HostNameidentifiedby"password";
grantupdate,deleteonmydb.TestTabletoNewUserName@HostNameidentifiedby"password";
若要给此用户赋予他在相应对象上的权限的管理能力,可在GRANT后面添加WITHGRANTOPTION选项。而对于用插入User表添加的用户,Password字段应用PASSWORD函数进行更新加密,以防不轨之人窃看密码。对于那些已经不用的用户应给予清除,权限过界的用户应及时回收权限,回收权限可以通过更新User表相应字段,也可以使用REVOKE操作。
下面给出本人从其它资料(www.cn-java.com)获得的对常用权限的解释:
全局管理权限:
FILE:在MySQL服务器上读写文件。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Websites for learning C language: 1. C Language Chinese Website; 2. Rookie Tutorial; 3. C Language Forum; 4. C Language Empire; 5. Script House; 6. Tianji.com; 7. Red and Black Alliance; 8, 51 Self-study network; 9. Likou; 10. C Programming. Detailed introduction: 1. C language Chinese website, which is a website dedicated to providing C language learning materials for beginners. It is rich in content, including basic grammar, pointers, arrays, functions, structures and other modules; 2. Rookie tutorials, This is a comprehensive programming learning website and more.

Do you frequently visit the same website at about the same time every day? This can lead to spending a lot of time with multiple browser tabs open and cluttering the browser while performing daily tasks. Well, how about opening it without having to launch the browser manually? It's very simple and doesn't require you to download any third-party apps, as shown below. How do I set up Task Scheduler to open a website? Press the key, type Task Scheduler in the search box, and then click Open. Windows On the right sidebar, click on the Create Basic Task option. In the Name field, enter the name of the website you want to open and click Next. Next, under Triggers, click Time Frequency and click Next. Select how long you want the event to repeat and click Next. Select enable

In macOS Sonoma and Safari 17, you can turn websites into "web apps," which can sit in your Mac's dock and be accessed like any other app without opening a browser. Read on to learn how it works. Thanks to a new option in Apple's Safari browser, it's now possible to turn any website on the internet you frequently visit into a standalone "web app" that lives in your Mac's dock and is ready for you to access at any time. The web app works with Mission Control and Stage Manager like any app, and can also be opened via Launchpad or SpotlightSearch. How to turn any website into

Methods to check dead links on a website include using online link tools, using webmaster tools, using robots.txt files, and using browser developer tools. Detailed introduction: 1. Use online link tools. There are many online dead link detection tools, such as LinkDeath, LinkDefender and Xenu. These tools can automatically detect dead links in the website; 2. Use webmaster tools. Most webmasters Tools, such as Google's Webmaster Tools, Baidu's Webmaster Tools, etc., all provide dead link detection functions and so on.

According to news from this site on January 9, Tmall Elf recently announced the upgrade of Yunyun access service. The upgraded Yunyun access service will change from free mode to paid mode starting from January 1. This site comes with new features and optimizations: optimizing the cloud protocol to improve the stability of device connections; optimizing voice control for key categories; account authorization upgrade: adding the display function of developer third-party apps in Tmall Genie to help users update faster It is convenient for account binding. At the same time, the third-party App account authorization for developers has been added to support one-click binding of Tmall Elf accounts; the terminal screen display interaction capability has been added. In addition to voice interaction, users can control devices and obtain information through the app and screen speakers. Equipment status; new intelligent scene linkage capabilities, new product attributes and events, which can be reported as status or events to define Tmall

PyCharm is a Python integrated development environment (IDE) developed by JetBrains. It provides Python developers with rich features and tools to help them write, debug and deploy Python code more efficiently. PyCharm has many powerful features, including intelligent code completion, syntax highlighting, debugger, unit testing tools, version control integration, code refactoring, etc. These features enable developers to quickly locate code issues, improve code quality, and accelerate development cycles.

In iOS17, Apple has added the option to clear Safari web history and website data. You can even clear the Safari cache for specific Safari profiles. Read on to learn how it works. Whenever you browse a web page in Safari, the browser stores website data so that you don't have to download it again each time you revisit the website. In theory, this should speed up your browsing experience, but in some cases you may want to clear your cache and start over. If a website you visit frequently contains elements that have stopped working, or the site has stopped loading entirely, there may be a conflict between an older version cached by Safari and a newer version. Or maybe you just want to pass

What are the techniques for website performance optimization? Specific code examples are needed. With the development of the Internet, websites have become an important tool for people to obtain information, communicate and achieve business goals. However, with the increase in the number of website users and the expansion of functions, website performance problems have become increasingly prominent. A website with low performance not only affects user experience, but may also lead to user loss and transaction failure. Therefore, website performance optimization has become an important issue that developers must face. For website performance optimization, developers can adopt some techniques and strategies to improve website performance.
