https://www.slackwiki.com/index.php?title=MySQL_Configuration&feed=atom&action=history
MySQL Configuration - Revision history
2024-03-29T05:27:17Z
Revision history for this page on the wiki
MediaWiki 1.40.0
https://www.slackwiki.com/index.php?title=MySQL_Configuration&diff=729&oldid=prev
Arfon: /etc/rc.d/rc.mysql start --> /etc/rc.d/rc.mysqld start AND ADDED: mysql> use mysql
2012-08-06T15:30:58Z
<p>/etc/rc.d/rc.mysql start --> /etc/rc.d/rc.mysqld start AND ADDED: mysql> use mysql</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 15:30, 6 August 2012</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l27">Line 27:</td>
<td colspan="2" class="diff-lineno">Line 27:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>You're now finished and should not see the typical MySQL errors at the login prompt.</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>You're now finished and should not see the typical MySQL errors at the login prompt.</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> /etc/rc.d/rc.<del style="font-weight: bold; text-decoration: none;">mysql </del>start</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> /etc/rc.d/rc.<ins style="font-weight: bold; text-decoration: none;">mysqld </ins>start</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Now you should set a password for MySQL's root password:</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Now you should set a password for MySQL's root password:</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l40">Line 40:</td>
<td colspan="2" class="diff-lineno">Line 40:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>For security reasons you should delete an empy user for localhost server</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>For security reasons you should delete an empy user for localhost server</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td></tr>
<tr><td colspan="2" class="diff-side-deleted"></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">mysql> use mysql</ins></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>mysql> SELECT user, host FROM user;</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>mysql> SELECT user, host FROM user;</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>mysql> DELETE FROM user WHERE host='localhost' AND user=''; </div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>mysql> DELETE FROM user WHERE host='localhost' AND user=''; </div></td></tr>
</table>
Arfon
https://www.slackwiki.com/index.php?title=MySQL_Configuration&diff=728&oldid=prev
Arfon: chmod 755 /etc/rc.d/rc.mysql --> chmod 755 /etc/rc.d/rc.mysqld
2012-08-06T15:22:36Z
<p>chmod 755 /etc/rc.d/rc.mysql --> chmod 755 /etc/rc.d/rc.mysqld</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 15:22, 6 August 2012</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l22">Line 22:</td>
<td colspan="2" class="diff-lineno">Line 22:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>chown -R mysql.mysql /var/lib/mysql</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>chown -R mysql.mysql /var/lib/mysql</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>chmod 755 /etc/rc.d/rc.<del style="font-weight: bold; text-decoration: none;">mysql</del></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>chmod 755 /etc/rc.d/rc.<ins style="font-weight: bold; text-decoration: none;">mysqld</ins></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></pre></div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></pre></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
</table>
Arfon
https://www.slackwiki.com/index.php?title=MySQL_Configuration&diff=95&oldid=prev
Erik: Copy from old
2009-06-02T03:35:46Z
<p>Copy from old</p>
<p><b>New page</b></p><div>[[Category:Tutorials]]<br />
''Have you just installed Slackware and now see a MySQL error at the login prompt?''<br />
<br />
This is a VERY quick HowTo and should take maybe 30 seconds to complete at its slowest. The reason I decided to do a write-up is because of the sheer number of people asking how to fix it.<br />
<br />
== Option 1 ==<br />
In a shell or xterm, type (you have to be logged in as superuser to use the mysql login):<br />
<br />
su mysql<br />
<br />
This logs you into the 'mysql' user account.<br />
<br />
Next, run:<br />
<br />
mysql_install_db<br />
<br />
This will create the needed databases and set their permissions properly.<br />
<br />
if your not logon as mysql user (root)<br />
<br />
Don't forget to chown folder /var/lib/mysql<br />
<pre><br />
chown -R mysql.mysql /var/lib/mysql<br />
chmod 755 /etc/rc.d/rc.mysql<br />
</pre><br />
<br />
You're now finished and should not see the typical MySQL errors at the login prompt.<br />
<br />
/etc/rc.d/rc.mysql start<br />
<br />
Now you should set a password for MySQL's root password:<br />
<br />
mysqladmin -u root password 'new-password-here'<br />
<br />
<br />
You can connect to your MySQL server with:<br />
mysql -u root -p<br />
<br />
<br />
For security reasons you should delete an empy user for localhost server<br />
<pre><br />
mysql> SELECT user, host FROM user;<br />
mysql> DELETE FROM user WHERE host='localhost' AND user=''; <br />
</pre><br />
*''This tutorial is currently linked at ''<br />
* ''http://www.unixfool.com/mysql-slack.shtml''<br />
<br />
== Option 2 ==<br />
1. log in as <b>root</b> and install the mysql package<br />
<br />
2. <code>killall -9 mysqld mysqld_safe</code> to kill any running MySQL processes.<br />
<br />
3. copy one of the my-size.cnf files in /etc to my.cnf (picking an apporpriate size):<br><br />
::<code>cp /etc/my-medium.cnf /etc/my.cnf</code><br />
<br />
4. Install the MySQL database-<br />
<br />
::'''Slackware 12.1''' (and later):<br />
::::<code>mysql_install_db --user=mysql</code><br />
<br />
::'''Slackware 12.0''' (and before):<br />
::::<code>su mysql</code><br />
::::<code>mysql_install_db</code><br />
:::: <code>exit</code> (to get out of the mysql login and back to root).<br />
<br />
5. <code>mysqld_safe --skip-grant-tables &</code><br />
<br />
6. <code>mysql -u root mysql</code><br />
<br />
7. <code>UPDATE user SET Password=PASSWORD('<i>new_password</i>') WHERE user='root';</code><br />
<br />
8. <code>FLUSH PRIVILEGES;</code><br />
<br />
9. <code>exit</code><br />
<br />
10. <code>killall -9 mysqld mysqld_safe</code><br />
<br />
11. <code>mysqld_safe &</code><br />
<br />
<br />
<br />
to check the new password, (as root) type:<br><br />
::<code>mysqladmin -u root -p status</code><br><br />
:::::...and enter the new password.<br />
<br />
<br />
<br />
== Option 3 ==<br />
<br />
I'm starting from a [http://www.slackwiki.org/Minimal_System very basic install]. <br />
<br />
The only additional package needed is '''mysql''' in the '''AP''' group.<br />
<br />
<pre><br />
# installpkg mysql-5.0.37-i486-1.tgz<br />
# su mysql<br />
$ mysql_install_db<br />
Installing all prepared tables<br />
Fill help tables<br />
...<br />
$ exit<br />
# chmod 755 /etc/rc.d/rc.mysqld <br />
# /etc/rc.d/rc.mysqld start<br />
Starting mysqld daemon with databases from /var/lib/mysql<br />
</pre><br />
<br />
MySQL is now installed, but there are no passwords defined yet.<br />
<br />
<pre><br />
# mysql -u root<br />
Welcome to the MySQL monitor. Commands end with ; or \g.<br />
Your MySQL connection id is 1<br />
Server version: 5.0.37 Source distribution<br />
<br />
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br />
</pre><br />
<br />
We can now set passwords from within the MySQL console. I know this can be achieved with '''mysqladmin''', but then, several ways lead to Rome. It's a simple matter of habit.<br />
<br />
<pre><br />
mysql> show databases;<br />
+--------------------+<br />
| Database |<br />
+--------------------+<br />
| information_schema | <br />
| mysql | <br />
| test | <br />
+--------------------+<br />
3 rows in set (0.01 sec)<br />
<br />
mysql> use mysql;<br />
Database changed<br />
<br />
mysql> select user, host, password from user where user = 'root';<br />
+------+-----------+----------+<br />
| user | host | password |<br />
+------+-----------+----------+<br />
| root | localhost | | <br />
| root | slacktest | | <br />
+------+-----------+----------+<br />
2 rows in set (0.00 sec)<br />
</pre><br />
<br />
As you can see, there are two 'root' users here (and none of them is our system's root user, don't forget): root@localhost... and root@slacktest. We have to set a password for both of them. In theory, these can be different, but why make things more complicated than they already are? ;o)<br />
<br />
<pre><br />
mysql> set password for root@localhost = password('yatahongaga');<br />
Query OK, 0 rows affected (0.00 sec)<br />
</pre><br />
<br />
Let's repeat our query above to see the actual changes:<br />
<br />
<pre><br />
mysql> select user, host, password from user where user = 'root';<br />
+------+-----------+-------------------------------------------+<br />
| user | host | password |<br />
+------+-----------+-------------------------------------------+<br />
| root | localhost | *71CDE2704222D8D5A7608C92AF78C53F78DA5EBA | <br />
| root | slacktest | | <br />
+------+-----------+-------------------------------------------+<br />
2 rows in set (0.00 sec)<br />
</pre><br />
<br />
You can see that root@localhost's password is displayed as a shadow password. Now let's set the password for root@slacktest (replace ''slacktest'' by your machine's hostname):<br />
<br />
<pre><br />
mysql> set password for root@slacktest = password('yatahongaga');<br />
Query OK, 0 rows affected (0.00 sec)<br />
</pre><br />
<br />
What do we have now?<br />
<br />
<pre><br />
mysql> select user, host, password from user where user = 'root';<br />
+------+-----------+-------------------------------------------+<br />
| user | host | password |<br />
+------+-----------+-------------------------------------------+<br />
| root | localhost | *71CDE2704222D8D5A7608C92AF78C53F78DA5EBA | <br />
| root | slacktest | *71CDE2704222D8D5A7608C92AF78C53F78DA5EBA | <br />
+------+-----------+-------------------------------------------+<br />
2 rows in set (0.00 sec)<br />
</pre><br />
<br />
Now we have some (very) basic security, we can leave the MySQL monitor.<br />
<br />
<pre><br />
mysql> quit;<br />
Bye<br />
</pre><br />
<br />
To connect to our MySQL database as MySQL's root user (who, remember, is ''not'' the system's root), we can do the following:<br />
<br />
<pre><br />
# mysql -u root -p<br />
Enter password: <br />
Welcome to the MySQL monitor. Commands end with ; or \g.<br />
Your MySQL connection id is 2<br />
Server version: 5.0.37 Source distribution<br />
<br />
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br />
<br />
mysql><br />
</pre><br />
<br />
If we have to do this often, we can create a /root/.my.cnf file and edit it as follows:<br />
<br />
<pre><br />
[mysql]<br />
user = root<br />
password = yatahongaga<br />
</pre><br />
<br />
Just to be on the safe side:<br />
<br />
<pre><br />
# chmod 0600 /root/.my.cnf<br />
</pre><br />
<br />
From now on, you can connect directly to the MySQL monitor, without having to type your password every time.</div>
Erik