{"id":66,"date":"2017-02-20T14:44:40","date_gmt":"2017-02-20T14:44:40","guid":{"rendered":"https:\/\/d1m0.com\/?p=66"},"modified":"2018-03-09T16:07:39","modified_gmt":"2018-03-09T16:07:39","slug":"mysql-hitns","status":"publish","type":"post","link":"https:\/\/d1m0.com\/?p=66","title":{"rendered":"mysql hints"},"content":{"rendered":"<p><strong>First steps<\/strong><br \/>\nmysql_secure_installation<\/p>\n<p><strong>Passwordpress login mysql<\/strong><\/p>\n<p>create ~\/.my.cnf\u00a0 with<br \/>\n[client]<br \/>\npassword=plaintextpassword<br \/>\nuser=root<\/p>\n<p><strong>Create Database<\/strong><\/p>\n<p>long variant ;<br \/>\ncreate database testdb;<\/p>\n<p>create user &#8216;testuser&#8217;@&#8217;localhost&#8217; identified by &#8216;password&#8217;;<\/p>\n<p>grant all on testdb.* to &#8216;testuser&#8217; identified by &#8216;password&#8217;;<\/p>\n<p><strong>short one :<\/strong><\/p>\n<p>create database testdb;<\/p>\n<p>grant all on testdb.* to &#8216;testuser&#8217; identified by &#8216;password&#8217;;<\/p>\n<p><strong>Reset the MySQL Root Password<\/strong><\/p>\n<p>systemctl stop mysqld<br \/>\nmysqld_safe &#8211;skip-grant-tables &amp;<br \/>\nmysql -u root<br \/>\nuse mysql; update user SET PASSWORD=PASSWORD(&#8220;password&#8221;) WHERE USER=&#8217;root&#8217;; flush privileges; exit<\/p>\n<p>systemctl start mysqld<\/p>\n<p><strong>Replication<\/strong><\/p>\n<p>Add in \/etc\/my.cnf\u00a0 in [mysqld]<\/p>\n<p>&#8212;master&#8212;<br \/>\nserver_id=1<br \/>\nlog-basename=master<br \/>\nlog-bin<br \/>\nbinlog-format=row<br \/>\nbinlog-do-db=$NAME-OF-DB-TO-REPLICATE<\/p>\n<p>&#8212;slave&#8212;<\/p>\n<p>server-id = 2<br \/>\nreplicate-do-db=$NAME-OF-DB-TO-REPLICATE<\/p>\n<p><strong>mysql-master-sql<\/strong><\/p>\n<pre>GRANT REPLICATION SLAVE ON *.* TO 'user'@'%' IDENTIFIED BY 'password';<\/pre>\n<p>start slave;<\/p>\n<p>SHOW MASTER STATUS;<\/p>\n<p>!!!!<em>Position<\/em> and\u00a0 <em>File<\/em> !!!<\/p>\n<p><strong>mysql-slave-sql<\/strong><\/p>\n<p>stop slave;<\/p>\n<p>CHANGE MASTER TO MASTER_HOST=&#8217;IP8&#8242;, MASTER_USER=&#8217;user&#8217;, MASTER_PASSWORD=&#8217;password&#8217;, MASTER_LOG_FILE=&#8217;<em>mariadb-bin.000005<\/em>&#8216;, MASTER_LOG_POS=<em>245<\/em> ,MASTER_CONNECT_RETRY=5 ;<\/p>\n<p>start slave;<\/p>\n<p>SHOW SLAVE STATUS\\G;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>First steps mysql_secure_installation Passwordpress login mysql create ~\/.my.cnf\u00a0 with [client] password=plaintextpassword user=root Create Database long variant ; create database testdb; create user &#8216;testuser&#8217;@&#8217;localhost&#8217; identified by &#8216;password&#8217;; grant all on testdb.* to &#8216;testuser&#8217; identified by &#8216;password&#8217;; short one : create database testdb; grant all on testdb.* to &#8216;testuser&#8217; identified by &#8216;password&#8217;; Reset the MySQL Root Password &#8230;<\/p>\n<p><a href=\"https:\/\/d1m0.com\/?p=66\" class=\"more-link\">Continue reading &lsquo;mysql hints&rsquo; &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-66","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/d1m0.com\/index.php?rest_route=\/wp\/v2\/posts\/66","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/d1m0.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/d1m0.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/d1m0.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/d1m0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=66"}],"version-history":[{"count":6,"href":"https:\/\/d1m0.com\/index.php?rest_route=\/wp\/v2\/posts\/66\/revisions"}],"predecessor-version":[{"id":402,"href":"https:\/\/d1m0.com\/index.php?rest_route=\/wp\/v2\/posts\/66\/revisions\/402"}],"wp:attachment":[{"href":"https:\/\/d1m0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=66"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/d1m0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=66"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/d1m0.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=66"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}