<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kumamoto🍡</title>
    <description>The latest articles on DEV Community by Kumamoto🍡 (@digitalhimiko).</description>
    <link>https://dev.to/digitalhimiko</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F536349%2Fe939e77c-9e49-4dd9-bc5f-ec1e58361fe5.jpg</url>
      <title>DEV Community: Kumamoto🍡</title>
      <link>https://dev.to/digitalhimiko</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/digitalhimiko"/>
    <language>en</language>
    <item>
      <title>Use mycli and Learn MariaDB/MySQL comfortably in a terminal! </title>
      <dc:creator>Kumamoto🍡</dc:creator>
      <pubDate>Sat, 12 Dec 2020 04:09:04 +0000</pubDate>
      <link>https://dev.to/digitalhimiko/use-mycli-and-learn-mariadb-mysql-comfortably-in-a-terminal-57cg</link>
      <guid>https://dev.to/digitalhimiko/use-mycli-and-learn-mariadb-mysql-comfortably-in-a-terminal-57cg</guid>
      <description>&lt;h1&gt;
  
  
  Target audience for this article
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;MariaDB (or MySQL) already installed&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Know some SQL&lt;br&gt;
If you have heard of &lt;code&gt;SELECT&lt;/code&gt; and &lt;code&gt;INSERT&lt;/code&gt;, you should be fine.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Want to play around with the DB using the CLI (the black screen of the terminal)&lt;br&gt;
If you want to operate a full-scale DB, it is easier to use a GUI such as &lt;a href="https://www.sequelpro.com/"&gt;Sequel Pro&lt;/a&gt;, but if you just want to touch the DB, it is easier to use the mycli on terminal.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;※ If you want to read the Japanese version of this article, &lt;br&gt;please go to &lt;a href="https://qiita.com/digitalhimiko/items/55f838771357e739c846"&gt;this one&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Preparation Let's set up mycli!
&lt;/h1&gt;

&lt;h2&gt;
  
  
  What is mycli anyway?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.mycli.net/"&gt;mycli&lt;/a&gt; is a CLI interface for common DB management systems such as MySQL (and MariaDB).&lt;br&gt;
※mycli stands for MySQL db client.&lt;/p&gt;
&lt;h2&gt;
  
  
  So, what are you happy about using mycli?
&lt;/h2&gt;

&lt;p&gt;The best part is that the completion makes it easier to type commands on the terminal and reduce typos.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Basic commands will be complemented.&lt;/li&gt;
&lt;li&gt;Table names and other completion suggestions will be displayed.&lt;/li&gt;
&lt;li&gt;Easy to see with color settings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sHHn0HhI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/eqabqvan6dg0s7idekfy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sHHn0HhI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/eqabqvan6dg0s7idekfy.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
The screenshot above shows the connection screen using the normal mysql command. It's hard to see and the command completion doesn't work.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oXyNFCF5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jnlcj3npds3emm3lofih.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oXyNFCF5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jnlcj3npds3emm3lofih.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
Here is a screenshot of the connection with the mycli command. It's colored and has a nice list of candidates!&lt;/p&gt;
&lt;h2&gt;
  
  
  Install mycli
&lt;/h2&gt;

&lt;p&gt;You can install mycli by &lt;code&gt;homebrew&lt;/code&gt; or &lt;code&gt;pip&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-- If you're Mac user
$ brew update
$ brew install mycli
-- If you're not
$ pip install mycli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that, check mycli installed successfully.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mycli --version
Version: 1.21.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Configure mycli's setting, color, key-bindings etc,,,
&lt;/h2&gt;

&lt;p&gt;We will change the configuration file &lt;code&gt;~/.myclirc&lt;/code&gt; by referring to the &lt;a href="https://www.mycli.net/syntax"&gt;official mycli website&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Change coloro(The text will be a young grass color.)
syntax_style = native
# Change key bindings
key_bindings = vi
# Display a wider selection of candidates
wider_completion_menu = True
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Let's try tweaking MariaDB (MySQL) with mycli.
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Connect to DB(DataBase)
&lt;/h2&gt;

&lt;p&gt;If you haven't created a DB yet, or if you don't remember what kind of DB you had, omit the database name and try the following "Check DB List".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mycli -u(USER_NAME) -p(PASSWORD) [DATABASE_NAME]

-- example
$ mycli -uroot -pBARBAR foo_db
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Check DB List
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SHOW DATABASES;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Create DB
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; CREATE DATABASE IF NOT EXISTS test;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Delete DB
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; DROP DATABASE IF EXISTS test;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Check the hostname of the connection destination.
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SHOW VARIABLES LIKE 'hostname';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Create Table
&lt;/h2&gt;

&lt;p&gt;The following query will create a table like this.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2Ay99IeE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fgyxuuiyme28onrp6sue.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2Ay99IeE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fgyxuuiyme28onrp6sue.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HUC0EAMM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gs4gwtrzli1ljdiisa26.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HUC0EAMM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gs4gwtrzli1ljdiisa26.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here's what the relation looks like(created by &lt;a href="https://github.com/k1LoW/tbls"&gt;tbls&lt;/a&gt;)&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2MlVwehC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wszuo7tsn19fgbjfoced.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2MlVwehC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wszuo7tsn19fgbjfoced.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE TABLE_NAME (COLUMN_NAME DATA_TYPE CONSTRAINT,...
FOREIGN KEY INDEX_NAME (COLUMN_NAME, ...) 
   REFERENCES TABLE_NAME_TO_REFERENCE (COLUMN_NAME, ...),
INDEX INDEX_NAME(COLUMN_NAME) COMMENT 'COMMENT');

-- example
&amp;gt; CREATE TABLE IF NOT EXISTS members (
id MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
name varchar(255) NOT NULL UNIQUE,
email varchar(255) NOT NULL UNIQUE,
password varchar(100) NOT NULL,
picture varchar(255) NOT NULL DEFAULT '/default_icon.jpg',
created DATETIME NOT NULL,
modified TIMESTAMP NOT NULL,
-- Index queries tend to be long, so I divide them as follows
INDEX idx_members_id_01(id) COMMENT 'for search member quickly'
);

&amp;gt; CREATE TABLE IF NOT EXISTS posts (
post_id MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
user_id MEDIUMINT NOT NULL,
content VARCHAR(900),
posted_at TIMESTAMP NOT NULL,
FOREIGN KEY fk_posts_userid_01(user_id)
    REFERENCES members (id)
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Show Table List
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SHOW TABLES;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Check Table Structure
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-- DESCRIBE is a synonym for EXPLAIN.
&amp;gt; DESCRIBE TABLE_NAME;

-- example
&amp;gt; DESCRIBE members;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Show Table's Create query
&lt;/h2&gt;

&lt;p&gt;You can get more detailed information than DESCRIBE statements from the following query.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SHOW CREATE TABLE TABLE_NAME;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Delete Table
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; DROP TABLE IF EXISTS TABLE_NAME
You're about to run a destructive command.
Do you want to proceed? (y/n): y
Your call!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Check index
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SHOW INDEX FROM TABLE_NAME;
-- example
&amp;gt; SHOW INDEX FROM members;
+---------+------------+-------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------------------+
| Table   | Non_unique | Key_name          | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment             |
+---------+------------+-------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------------------+
| members | 0          | PRIMARY           | 1            | id          | A         | 0           | &amp;lt;null&amp;gt;   | &amp;lt;null&amp;gt; |      | BTREE      |         |                           |
| members | 0          | name              | 1            | name        | A         | 0           | &amp;lt;null&amp;gt;   | &amp;lt;null&amp;gt; |      | BTREE      |         |                           |
| members | 0          | email             | 1            | email       | A         | 0           | &amp;lt;null&amp;gt;   | &amp;lt;null&amp;gt; |      | BTREE      |         |                           |
| members | 1          | idx_members_id_01 | 1            | id          | A         | 0           | &amp;lt;null&amp;gt;   | &amp;lt;null&amp;gt; |      | BTREE      |         | for search member quickly |
+---------+------------+-------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The meanings of the above indications are as follows.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Item&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Table&lt;/td&gt;
&lt;td&gt;Table name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Non_unique&lt;/td&gt;
&lt;td&gt;0 if the index cannot contain duplicates, 1 if it can.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Key_name&lt;/td&gt;
&lt;td&gt;Index name if this index is primary key, the name of key is always PRIMARY&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Seq_in_index&lt;/td&gt;
&lt;td&gt;The column sequence number in the index, starting from 1.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Column_name&lt;/td&gt;
&lt;td&gt;Column name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Collation&lt;/td&gt;
&lt;td&gt;How the column is sorted; in MySQL, this is either "A" (ascending) or NULL (unsorted)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cardinality&lt;/td&gt;
&lt;td&gt;It refers to the types of values that a column can take. The higher the cardinality, the more likely it is that MySQL will use this index when performing a join.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sub_part&lt;/td&gt;
&lt;td&gt;If the column is only partially indexed, the number of indexed characters. NULL if the entire column is indexed.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Packed&lt;/td&gt;
&lt;td&gt;Indicates how the key will be packed. NULL if it is not packed.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NULL&lt;/td&gt;
&lt;td&gt;If this column can contain NULL values, then YES is used; otherwise, '' is used.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Index_type&lt;/td&gt;
&lt;td&gt;Indexing method used (BTREE、FULLTEXT、HASH、RTREE)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Comment&lt;/td&gt;
&lt;td&gt;Information about this index (e.g. disabled if the index is disabled)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Index_comment&lt;/td&gt;
&lt;td&gt;Any comment that was provided for the index in the COMMENT attribute when the index was created.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Add index to a column in a table that has already been created
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; ALTER TABLE TABLE_NAME ADD INDEX INDEX_NAME(COLUMN_NAME);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Delete index
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; DROP INDEX INDEX_NAME ON TABLE_NAME;
-- Or that following is also OK
&amp;gt; ALTER TABLE TABLE_NAME DROP INDEX INDEX_NAME;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Update index comment
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; ALTER TABLE TABLE_NAME
 DROP INDEX INDEX_NAME,
 ADD FULLTEXT INDEX INDEX_NAME (COLUMN_NAME) COMMENT "COMMENT";

-- example
&amp;gt; ALTER TABLE members 
 DROP INDEX idx_members_id_01, 
 ADD INDEX idx_members_01 (id) COMMENT "ARA ARA";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Insert data
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; INSERT INTO TABLE_NAME (COLUMN_NAME) VALUES (VALUE);

-- example1
&amp;gt; INSERT INTO members 
VALUES
(1, 'Nobunaga Oda', 'nobu_oda@example.com', 'HOGE', '/oda_icon.jpg', '2020-12-02 1:14:22', '2020-12-02 1:14:22');

-- example2
&amp;gt; INSERT INTO members
(name, email, password, picture, created)
VALUES
('Hideyoshi Toyotomi', 'hide_toyo@example.com', 'FUGA', '/toyo_icon.jpg', '2020-12-01 10:00:00');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Delete data
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; DELETE FROM TABLE_NAME;

-- example1
DELETE FROM members;
-- example2
DELETE FROM members WHERE id=3;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Select data
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SELECT COLUMN_NAME, FROM TABLE_NAME;

-- example1
&amp;gt; SELECT id, name FROM members;
-- example2
&amp;gt; SELECT * FROM members;
-- example3
&amp;gt; SELECT * FROM members WHERE id=3;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  +α Where the author once got stuck.
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Columns with &lt;code&gt;AUTO_INCREMENT&lt;/code&gt; constraint must be set to key.
&lt;/h2&gt;

&lt;p&gt;Let's add indexes and set &lt;code&gt;PRIMARY KEY&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE members (
id INT NOT NULL AUTO_INCREMENT,
name varchar(255)
);
(1075, 'Incorrect table definition; there can be only one auto column and it must be defined as a key')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Can not &lt;code&gt;DROP INDEX&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Check an following index using by &lt;code&gt;SHOW INDEX&lt;/code&gt;, and try to delete &lt;code&gt;PRIMARY&lt;/code&gt; but,,,&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UJKNflcf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/g2v8xgdrnn3jep69qfel.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UJKNflcf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/g2v8xgdrnn3jep69qfel.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; ALTER TABLE members DROP INDEX PRIMARY;
(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PRIMARY ON members' at line 1")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The reason is that the index name of the primary key is always PRIMARY, but PRIMARY is a reserved word, so you have to specify it as a quoted identifier or else an error will occur. It will work if you enclose it in a backquote as follows&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; ALTER TABLE members DROP INDEX `PRIMARY`;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: you can't DROP the KEY of a column which has only one KEY because &lt;code&gt;AUTO_INCREMENT&lt;/code&gt; is set.&lt;/p&gt;

&lt;h1&gt;
  
  
  Reference
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://www.mycli.net/"&gt;mycli official document&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.tecmint.com/mycli-mysql-client-with-auto-completion-syntax-highlighting/#:%7E:text=MyCLI%20is%20an%20easy%2Dto,SSL%20to%20the%20MySQL%20server."&gt;MyCLI – A MySQL/MariaDB Client with Auto-completion and Syntax-highlighting / TecMint&lt;/a&gt;&lt;/p&gt;

</description>
      <category>mysql</category>
      <category>mariadb</category>
      <category>sql</category>
      <category>mycli</category>
    </item>
  </channel>
</rss>
