<rdf:RDF
    xmlns:s='http://snipsnap.org/rdf/snip-schema#'
    xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
    xml:base='http://www.stefanrufer.ch/snipsnap/rdf'>
    <s:Snip rdf:about='http://www.stefanrufer.ch/snipsnap/rdf#Virtual+Brain/MySQL'
         s:cUser='stefan'
         s:oUser='stefan'
         s:mUser='stefan'>
        <s:name>Virtual Brain/MySQL</s:name>
        <s:content>1 Changing MySQL root password&#xD;&#xA;&#xD;&#xA;Start mysql with the --skip-grant-tables option:&#xD;&#xA;&#xD;&#xA;{code}&#xD;&#xA;[root@vs /]# service mysql stop&#xD;&#xA;Shutting down MySQL. SUCCESS! &#xD;&#xA;[root@vs /]# /usr/sbin/mysqld --skip-grant-tables --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/vs.vserver.de.pid --skip-external-locking --socket=/var/lib/mysql/mysql.sock&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;And (in another shell) change the root password:&#xD;&#xA;&#xD;&#xA;{code}&#xD;&#xA;[root@vs /]# mysql&#xD;&#xA;Welcome to the MySQL monitor.  Commands end with ; or \g.&#xD;&#xA;Your MySQL connection id is 3 to server version: 4.1.22-standard&#xD;&#xA;&#xD;&#xA;Type &apos;help;&apos; or &apos;\h&apos; for help. Type &apos;\c&apos; to clear the buffer.&#xD;&#xA;&#xD;&#xA;mysql&gt; UPDATE mysql.user SET Password=PASSWORD(&apos;xxxx&apos;) WHERE User=&apos;root&apos;;&#xD;&#xA;Query OK, 2 rows affected (0.02 sec)&#xD;&#xA;Rows matched: 2  Changed: 2  Warnings: 0&#xD;&#xA;&#xD;&#xA;mysql&gt; FLUSH PRIVILEGES;&#xD;&#xA;Query OK, 0 rows affected (0.00 sec)&#xD;&#xA;&#xD;&#xA;mysql&gt; exit&#xD;&#xA;Bye&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;Restart the mysql service, and see: Login as root works again:&#xD;&#xA;&#xD;&#xA;{code}&#xD;&#xA;[root@vs /]# mysql -u root --password=xxxx&#xD;&#xA;Welcome to the MySQL monitor.  Commands end with ; or \g.&#xD;&#xA;Your MySQL connection id is 1 to server version: 4.1.22-standard&#xD;&#xA;&#xD;&#xA;Type &apos;help;&apos; or &apos;\h&apos; for help. Type &apos;\c&apos; to clear the buffer.&#xD;&#xA;&#xD;&#xA;mysql&gt; &#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;1 Creating new databases/users with skip-grant-tables option&#xD;&#xA;&#xD;&#xA;Use the mysql startup command above to run the DB with skip-grant-tables option and connect as root in another shell.&#xD;&#xA;&#xD;&#xA;The following code creates a new database and assigns one user SELECT, INSERT, UPDATE, DELETE, CREATE and DROP privileges on this database. The user is only allowed to connect from localhost. The SQL uses the OLD_PASSWORD() hash function because the PHP version (4.3.11) running against the DB (MySQL 4.1.22) does not support the new password hashes. &#xD;&#xA;&#xD;&#xA;{code}&#xD;&#xA;mysql&gt; use mysql&#xD;&#xA;mysql&gt; create database usr_web5_1&#xD;&#xA;    -&gt; ;&#xD;&#xA;Query OK, 1 row affected (0.00 sec)&#xD;&#xA;&#xD;&#xA;--doesn&apos;t work because DB is started with --skip-grant-tables option&#xD;&#xA;GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP&#xD;&#xA;     ON usr_web5_1.*&#xD;&#xA;     TO &apos;web5&apos;@&apos;localhost&apos;&#xD;&#xA;     IDENTIFIED BY &apos;somepw&apos;;&#xD;&#xA;&#xD;&#xA;--Replacement for the grant statement above&#xD;&#xA;INSERT INTO user (Host,User,Password)&#xD;&#xA;     VALUES(&apos;localhost&apos;,&apos;web5&apos;,OLD_PASSWORD(&apos;obscure&apos;));&#xD;&#xA;&#xD;&#xA;INSERT INTO db&#xD;&#xA;     (Host,Db,User,Select_priv,Insert_priv,&#xD;&#xA;     Update_priv,Delete_priv,Create_priv,Drop_priv)&#xD;&#xA;     VALUES(&apos;localhost&apos;,&apos;usr_web5_1&apos;,&apos;web5&apos;,&#xD;&#xA;     &apos;Y&apos;,&apos;Y&apos;,&apos;Y&apos;,&apos;Y&apos;,&apos;Y&apos;,&apos;Y&apos;);&#xD;&#xA;&#xD;&#xA;-- updating a password&#xD;&#xA;UPDATE mysql.user SET Password=OLD_PASSWORD(&apos;somepw&apos;) WHERE User=&apos;web5&apos;;&#xD;&#xA;{code}&#xD;&#xA;Nicely kill database deamon running in the other shell and start the mysql service again.&#xD;&#xA;&#xD;&#xA;</s:content>
        <s:mTime>2010-01-31 00:06:14.79</s:mTime>
        <s:cTime>2009-03-10 00:01:21.421</s:cTime>
        <s:comments
             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
        <s:snipLinks>
            <rdf:Bag>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#Virtual Brain/SQL'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#Virtual Brain'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#My Projects/Hochzeit/Vorstellungen'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#Virtual Brain/Linux'/>
                <rdf:li rdf:resource='#Buch'/>
                <rdf:li rdf:resource='#stefan'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#Virtual+Brain/Linux'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#Virtual Brain/Java/snipsnap contributions'/>
            </rdf:Bag>
        </s:snipLinks>
        <s:attachments
             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
    </s:Snip>
</rdf:RDF>

