List:Internals« Previous MessageNext Message »
From:Beotel Date:November 27 2000 10:19am
Subject:Re: mysql.db constraints
View as plain text  
On Sun, 26 Nov 2000 22:45:44 -0500 (EST), Ryan W. Maple said:

> -----BEGIN PGP SIGNED MESSAGE-----
>  Hash: SHA1
>  
>  
>  Greetings,
>  
>  I recently ran across this problem when using a very long database name.
>  As I understand it, the database name can be as long as you want depending
>  on your platform.  I am not sure of the max size of a Linux directory off
>  the top of my head but I know it can be very long.
>  
>  So the proof-of-concept below illustrates my problem.  I have a
>  46-character database name:
>  "this_is_a_really_really_long_table_that_breaks".
>  
>  When I attempt to perform access control, using the mysql.db table, my
>  entry gets truncated down to 32 characters
>  ("this_is_a_really_really_long_tab") since the mysql.db Db field is set to
>  be 32 at most.
>  
>  So I'm assuming this is done for OS's that have a small limit (Windows
>  comes to mind but again, I'm not positive).  So my question is:  If I
>  alter this size to say, 64 characters... would that break anything
>  internally?
>  
>  I'm assuming that it will not but haven't looked at the source code yet.
>  
>  For the record, I am using 3.22.32 on Linux 2.2.x.
>  
>  Any insight would be appreciated.  I can easily tweak this myself but I
>  wanted to make sure that nothing "internal" would break as a result.
>  
>  Cheers,
>  Ryan
>  
>   +-- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --+
>     Ryan W. Maple          "I dunno, I dream in Perl sometimes..."  -LW
>     Guardian Digital, Inc.                     ryan@stripped
>   +-- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --+
>  
>  
>  - ----- BEGIN PROOF OF CONCEPT -----
>  mysql> SHOW DATABASES;
>  +------------------------------------------------+
>  | Database                                       |
>  +------------------------------------------------+
>  | mysql                                          |
>  | this_is_a_really_really_long_table_that_breaks |
>  +------------------------------------------------+
>  5 rows in set (0.00 sec)
>  
>  mysql> SELECT User, Host, DB FROM mysql.db;
>  +------------+-----------+----------------------------------+
>  | User       | Host      | DB                               |
>  +------------+-----------+----------------------------------+
>  | root       | localhost | this_is_a_really_really_long_tab |
>  +------------+-----------+----------------------------------+
>  3 rows in set (0.00 sec)
>  
>  mysql> DESCRIBE mysql.db;
>  +-----------------+---------------+------+-----+---------+-------+
>  | Field           | Type          | Null | Key | Default | Extra |
>  +-----------------+---------------+------+-----+---------+-------+
>  | Host            | char(60)      |      | PRI |         |       |
>  | Db              | char(32)      |      | PRI |         |       |
>  | User            | char(16)      |      | PRI |         |       |
>  | Select_priv     | enum('N','Y') |      |     | N       |       |
>  | Insert_priv     | enum('N','Y') |      |     | N       |       |
>  | Update_priv     | enum('N','Y') |      |     | N       |       |
>  | Delete_priv     | enum('N','Y') |      |     | N       |       |
>  | Create_priv     | enum('N','Y') |      |     | N       |       |
>  | Drop_priv       | enum('N','Y') |      |     | N       |       |
>  | Grant_priv      | enum('N','Y') |      |     | N       |       |
>  | References_priv | enum('N','Y') |      |     | N       |       |
>  | Index_priv      | enum('N','Y') |      |     | N       |       |
>  | Alter_priv      | enum('N','Y') |      |     | N       |       |
>  +-----------------+---------------+------+-----+---------+-------+
>  13 rows in set (0.00 sec)
>  - ----- END PROOF OF CONCEPT -----
>  
>  
>  -----BEGIN PGP SIGNATURE-----
>  Version: GnuPG v1.0.4 (GNU/Linux)
>  Comment: For info see http://www.gnupg.org
>  
>  iD8DBQE6IdjsIwAIA9MpKWcRAnrxAKCoGqMiznIQc2kdDci6C+IUdUkFWwCeIg8z
>  UwwHVijhqbzfA25LFRzomZ0=
>  =q+Xx
>  -----END PGP SIGNATURE-----
>  

Hi!

Maximum database name length in MySQL is 64, but you should also know
that underscores are wild cards in SQL, so you should escape those
whenever you want to use your database name in any command.

-- 

Regards,

Sinisa

      ____  __	   _____   _____  ___	  ==  MySQL AB
     /*/\*\/\*\   /*/ \*\ /*/ \*\ |*|	  Sinisa Milivojevic
    /*/ /*/ /*/   \*\_	 |*|   |*||*|	  mailto:sinisa@stripped
   /*/ /*/ /*/\*\/*/  \*\|*|   |*||*|	  Larnaka, Cyprus
  /*/	  /*/  /*/\*\_/*/ \*\_/*/ |*|____
  ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^
	     /*/	     \*\		Developers Team


Thread
mysql.db constraintsRyan W. Maple27 Nov
  • Re: mysql.db constraintsBeotel27 Nov
  • Re: mysql.db constraintsRussell E Glaue27 Nov
    • LOCALSTATEDIR or DATADIR (Documentation Error ?)Russell E Glaue1 Dec
  • Re: mysql.db constraintsSasha Pachev27 Nov