怎么新建MYSQL用户(mysql怎么新建一个用户)

#头条创作挑战赛#

怎么新建MYSQL用户,并限制他MYSQL空间!
新建用户时,下面的权限一个也不要选(切记),只填入主机名,用户名,密码,就可以。
然后点重启 Mysql 。
建立一个空数据库。
然后找到新建的那个用户,点Grants ,进去后,选择刚建的那个数据库,
授予下面的权限:
Select,Insert ,Update,Delete,Create ,Drop,Alter
再点重启 Mysql !
用户就建完了。

附一个国外用户的解答:

There is no out of the box solution. But you can do the following:

  1. Get the data_length and index_length for the tables the user owns with show table status (This is the amount of space the data files use in the file system)
  2. Sum up these numbers for all databases
  3. If the limit is reached, remove for example INSERT privileges for that user, so he can not insert new data anymore.

But keep in mind that removing data from an InnoDB tables will not free up space in the file system. So if your user reached the limit, he can not do anything against it. (Except dumping all InnoDB tables, dropping them and reimport them)

怎么新建MYSQL用户(mysql怎么新建一个用户)

相关文章:

你感兴趣的文章:

标签云: