{"id":2029,"date":"2016-07-01T08:42:58","date_gmt":"2016-07-01T05:42:58","guid":{"rendered":"http:\/\/www.fatihacar.com\/blog\/?p=2029"},"modified":"2016-12-01T15:18:53","modified_gmt":"2016-12-01T12:18:53","slug":"mysql-frequently-using-commands","status":"publish","type":"post","link":"http:\/\/www.fatihacar.com\/blog\/mysql-frequently-using-commands\/","title":{"rendered":"MySQL Frequently Using Commands"},"content":{"rendered":"<p>MySQL is one of the most using database system. Almost all web sites are using MySQL database. I wrote most using commands of MySQL database.I will share various commands using examples for MySQL database .<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2030\" src=\"http:\/\/www.fatihacar.com\/blog\/resimler\/mysql.jpg\" alt=\"mysql\" width=\"600\" height=\"266\" srcset=\"http:\/\/www.fatihacar.com\/blog\/resimler\/mysql.jpg 600w, http:\/\/www.fatihacar.com\/blog\/resimler\/mysql-300x133.jpg 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><strong>Connect MySQL<\/strong><\/p>\n<blockquote><p>[root@testdb ~]# mysql<br \/>\n[root@testdb ~]# mysql -h hostip<br \/>\n[root@testdb ~]# mysql -h hostip -u username<br \/>\n[root@testdb ~]# mysql dbname -u username<br \/>\n[root@testdb ~]# mysql dbname -u username -P portnumber<\/p><\/blockquote>\n<p><strong>List, Add, Drop MySQL Database<\/strong><\/p>\n<blockquote><p><strong>List databases<\/strong><\/p>\n<p>mysql&gt; show databases;<\/p>\n<p><strong>Add database<\/strong><\/p>\n<p>mysql&gt; create database testdb<\/p>\n<p><strong>Drop database<\/strong><\/p>\n<p>mysql&gt; drop database testdb<\/p><\/blockquote>\n<p><strong>List, Add, Drop, Change and Grant User<\/strong><\/p>\n<blockquote><p>mysql&gt; use mysql<br \/>\nmysql&gt; create user facar;<br \/>\nmysql&gt; drop user facar;<br \/>\nmysql&gt;\u00a0update user set password=PASSWORD(&#8220;newpassword&#8221;) where user=&#8217;facar&#8217;;<br \/>\nmysql&gt; grant all privileges on testdb.* to facar;<br \/>\nmysql&gt; grant all privileges on *.* to facar;<br \/>\nmysql&gt; revoke all privileges on testdb.* from facar;<br \/>\nmysql&gt; revoke all privileges on *.* from facar;<br \/>\nmysql&gt; flush privileges;<br \/>\nmysql&gt; grant usage on testdb.* to facar identified by &#8216;password&#8217;;<br \/>\nmysql&gt; grant usage on *.* to facar identified by &#8216;password&#8217;;<br \/>\nmysql&gt; revoke usage on testdb.* from facar<br \/>\nmysql&gt; revoke usage on *.* from facar<br \/>\nmysql&gt; flush privileges;<\/p><\/blockquote>\n<p><strong>Information Queries of MySQL Database<\/strong><\/p>\n<blockquote><p>mysql&gt; help;<\/p>\n<p>mysql&gt; use testdb;<br \/>\nmysql&gt; show tables;<br \/>\nmysql&gt; desc tablename;<\/p>\n<p>mysql&gt; connect mysql;<br \/>\nmysql&gt; select user();<\/p>\n<p>mysql&gt; show variables;<br \/>\nmysql&gt; show variables where variable_name = &#8216;Port&#8217;;<\/p>\n<p>[root@testdb ~]# mysqladmin &#8211;help<br \/>\n[root@testdb ~]# mysqladmin &#8211;version<br \/>\n[root@testdb ~]# mysqladmin ping<br \/>\n[root@testdb ~]# mysqladmin variables<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>MySQL is one of the most using database system. Almost all web sites are using MySQL database. I wrote most using commands of MySQL database.I will share various commands using examples for MySQL database . Connect MySQL [root@testdb ~]# mysql [root@testdb ~]# mysql -h hostip [root@testdb ~]# mysql -h hostip -u username [root@testdb ~]# mysql&#8230;<\/p>\n","protected":false},"author":37,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[43],"tags":[100,44],"class_list":["post-2029","post","type-post","status-publish","format-standard","hentry","category-administration-mysql","tag-mysql","tag-mysql-administration"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p39NFI-wJ","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/posts\/2029","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/users\/37"}],"replies":[{"embeddable":true,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/comments?post=2029"}],"version-history":[{"count":4,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/posts\/2029\/revisions"}],"predecessor-version":[{"id":2034,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/posts\/2029\/revisions\/2034"}],"wp:attachment":[{"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/media?parent=2029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/categories?post=2029"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/tags?post=2029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}