<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Mysql on Michael’s Domain</title><link>https://jeltsch.org/en/tags/mysql/</link><description>Recent content in Mysql on Michael’s Domain</description><generator>Hugo</generator><language>en-us</language><copyright>Copyright © 2002 - 2026 Michael Jeltsch.</copyright><lastBuildDate>Fri, 24 Jul 2026 00:18:18 +0300</lastBuildDate><atom:link href="https://jeltsch.org/en/tags/mysql/index.xml" rel="self" type="application/rss+xml"/><item><title>Reset the admin (user #1) password in Drupal 9</title><link>https://jeltsch.org/en/reset_the_admin_user_password_in_drupal_9/</link><pubDate>Wed, 01 Jan 2025 00:00:00 +0000</pubDate><guid>https://jeltsch.org/en/reset_the_admin_user_password_in_drupal_9/</guid><description>&lt;p&gt;I have been playing around with Drupal 9 and forgot the admin password. If this happens to you, go to the base folder of the drupal installation.&lt;/p&gt;</description></item><item><title>How to reset the admin password in Drupal 9</title><link>https://jeltsch.org/en/reset_admin_password_in_drupal_9/</link><pubDate>Sat, 09 Apr 2022 00:00:00 +0000</pubDate><guid>https://jeltsch.org/en/reset_admin_password_in_drupal_9/</guid><description>&lt;ol&gt;
&lt;li&gt;Go to the base folder of the drupal installation&lt;/li&gt;
&lt;li&gt;Generate the hash for your password: php core/scripts/password-hash.sh &amp;rsquo;newpasswd'&lt;/li&gt;
&lt;li&gt;Execute in mysql: UPDATE users_field_data SET pass=&amp;lsquo;hash_result_from_previous_command_goes_here&amp;rsquo; WHERE uid = 1;&lt;/li&gt;
&lt;li&gt;Clear the cache: DELETE FROM cache_entity WHERE cid = &amp;lsquo;values:user:1&amp;rsquo;;&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>mysql server restart</title><link>https://jeltsch.org/en/mysql_server_restart/</link><pubDate>Thu, 11 Sep 2008 00:00:00 +0000</pubDate><guid>https://jeltsch.org/en/mysql_server_restart/</guid><description>&lt;p&gt;My mysqld runs on Ubuntu Hardy and after replacing the complete mysql data with a dump from another server the &amp;ldquo;/etc/init.d/mysql stop&amp;rdquo; command fails, because the system administration account doesn&amp;rsquo;t work anymore. So I had to recreate it again:&lt;code&gt;GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;&lt;/code&gt;The password can be obtained from /etc/mysql/debian.cnf.&lt;/p&gt;</description></item><item><title>MySQL install</title><link>https://jeltsch.org/en/mysql_install/</link><pubDate>Wed, 23 May 2007 00:00:00 +0000</pubDate><guid>https://jeltsch.org/en/mysql_install/</guid><description>&lt;p&gt;After installing the Suse 9 rpm, execute the following commands:&lt;code&gt;sudo /usr/bin/mysql_install_db&lt;/code&gt;(Creating default databases &amp;amp; permissions. Apparently the same can be done by &amp;ldquo;sudo rcmysql start&amp;rdquo;)&lt;code&gt;sudo /usr/bin/mysqld_safe --user=mysql &amp;amp;&lt;/code&gt;(Start the server for the first time)REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! This is done with: &lt;code&gt;/usr/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h hostname password 'new-password'&lt;/code&gt;Give all privileges to root and user:&lt;code&gt;/usr/bin/mysql -u root -p Enter password:Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 to server version: 4.0.15 Type 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql&amp;gt; GRANT ALL PRIVILEGES ON *.* TO user@localhost IDENTIFIED BY 'Password' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec)mysql&amp;gt; GRANT ALL PRIVILEGES ON *.* TO user@'%' IDENTIFIED BY 'Password' WITH GRANT OPTION;Query OK, 0 rows affected (0.00 sec)mysql&amp;gt; GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY 'Password' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec)mysql&amp;gt; GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY 'Password' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec)mysql&amp;gt; quit Bye``/usr/bin/mysqladmin version&lt;/code&gt;(later &amp;ldquo;/usr/bin/mysqladmin -u root -p version&amp;rdquo; is necessary)&lt;code&gt;/usr/bin/mysqladmin variables&lt;/code&gt;(later &amp;ldquo;/usr/bin/mysqladmin -u root -p variables&amp;rdquo; is necessary)&lt;code&gt;/usr/bin/mysqladmin -u root -p shutdown&lt;/code&gt;(can you shutdown the server?)&lt;code&gt;sudo /usr/bin/mysqld_safe --log &amp;amp;&lt;/code&gt;(can you start the server?)&lt;code&gt;ps -A | grep mysql&lt;/code&gt;(check whether the server process is running)&lt;code&gt;/usr/bin/mysqlshow -u root -p&lt;/code&gt;(show all databases)&lt;code&gt;/usr/bin/mysqlshow -u root -p mysql&lt;/code&gt;(show the tables of database &amp;ldquo;mysql&amp;rdquo;)To start the mysql daemon at system startup, you should go to the runlevel editor (advanced mode) and toggle the status for the mysql entry of init.d&lt;/p&gt;</description></item><item><title>Resetting the MySQL root password</title><link>https://jeltsch.org/en/resetting_the_mysql_root_password/</link><pubDate>Thu, 05 Apr 2007 00:00:00 +0000</pubDate><guid>https://jeltsch.org/en/resetting_the_mysql_root_password/</guid><description>&lt;p&gt;If you have forgotten your MySQL root password, you can reset it if you have physical access to the machine mysql is running on: Find the .pid file of the mysql process. It is either called mysql.pid or machinename.pid. Kill the mysql process. On my MacOS X server e.g. &lt;code&gt;kill &lt;/code&gt;cat /usr/local/mysql-standard-4.0.16-apple-darwin6.6-powerpc/data/localhost.pid`` Restart the mysql server &lt;code&gt;/usr/local/mysql-standard-4.0.16-apple-darwin6.6-powerpc/bin/mysqld_safe --skip-grant-tables &amp;amp;&lt;/code&gt; Set the new root password (replace newpassword with the new password!) &lt;code&gt;/usr/local/mysql-standard-4.0.16-apple-darwin6.6-powerpc/bin/mysqladmin -u root flush-privileges password &amp;quot;newpassword&amp;quot;&lt;/code&gt; Done!&lt;/p&gt;</description></item><item><title>Migrating the Mad Thought Blog to a new server (mysql, php)</title><link>https://jeltsch.org/en/migrating_the_mad_thought_blog_to_a_new_server_mysql_php/</link><pubDate>Wed, 04 Apr 2007 00:00:00 +0000</pubDate><guid>https://jeltsch.org/en/migrating_the_mad_thought_blog_to_a_new_server_mysql_php/</guid><description>&lt;ol&gt;
&lt;li&gt;Dump the database data mysqldump &amp;ndash;host=localhost &amp;ndash;user=root -p journal &amp;gt;journal.sql&lt;/li&gt;
&lt;li&gt;Create the databse on the new machine mysql -u root -p CREATE DATABASE journal;&lt;/li&gt;
&lt;li&gt;Import the data into the database mysql -p -h localhost journal &amp;lt; journal.sql&lt;/li&gt;
&lt;li&gt;Create the user &amp;lsquo;journal&amp;rsquo; GRANT ALL PRIVILEGES ON &lt;em&gt;.&lt;/em&gt; TO &amp;lsquo;journal&amp;rsquo;@&amp;rsquo;localhost&amp;rsquo; IDENTIFIED BY &amp;lsquo;journal&amp;rsquo; WITH GRANT OPTION;&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>How to transfer the oligo database from MacVec tor to a web-based blast database</title><link>https://jeltsch.org/en/how_to_transfer_the_oligo_database_from_macvec_tor_to_a_web_based_blast_database/</link><pubDate>Tue, 06 Mar 2007 00:00:00 +0000</pubDate><guid>https://jeltsch.org/en/how_to_transfer_the_oligo_database_from_macvec_tor_to_a_web_based_blast_database/</guid><description>&lt;ol&gt;
&lt;li&gt;Save all sequences in one flatfile format (NOT MacVector format), e.g. genbank format.2. Copy all sequences to a Linux/UNIX computer and convert them from Mac format to UNIX format: mac2unix *.gb3. Write all sequence fiule names into one file: ls *.gb &amp;gt; oligo.lst4. Convert all sequences into one file of concatenated fasta entries using EMBOSS: seqret -sequence @oligo.lst -osformat fasta. Call the output file &amp;ldquo;mcbl_oligo_db&amp;quot;5. Put this fasta file into the blast web servers database directory (…/blast/db)6. Format the database: formatdb -i mcbl_oligo_db -p F -o T7. Edit …/blast/blast.html by adding the new database name8. Edit …/blast/blast.rc by adding the new database name&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>Migrating my old mysql blog database to a new blog software (PluggedOut)</title><link>https://jeltsch.org/en/migrating_my_old_mysql_blog_database_to_a_new_blog_software_pluggedout/</link><pubDate>Tue, 06 Mar 2007 00:00:00 +0000</pubDate><guid>https://jeltsch.org/en/migrating_my_old_mysql_blog_database_to_a_new_blog_software_pluggedout/</guid><description>&lt;p&gt;We updated my server from SuSE 9.3 to 10.1. php5 is the default on 10.1 and my blog software broke. As my blog software is not anymore maintained, I had to switch to another and I selected 
 &lt;a href="http://www.pluggedout.com" target="_blank" rel="noopener noreferrer nofollow"&gt;PluggedOut&amp;nbsp;






 
 
 
 &lt;svg class="svg-inline--fa fas fa-up-right-from-square fa-2xs" fill="currentColor" aria-hidden="true" role="img" viewBox="0 0 512 512" overflow="visible"&gt;&lt;use href="#fas-up-right-from-square"&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/a&gt;
. The mysql database structures were quite different and this is what I did to do the conversion:First I dumped the old database into textfiles:&lt;code&gt;mysqldump -u root -p --tab=/home/jeltsch/temp --fields-terminated-by=| --lines-terminated-by=# journal&lt;/code&gt;Then I opened the textfiles in a spreadsheet application and added the necessary columns and fixed the formats. Then I exported into a csv file and imported back into the new database:&lt;code&gt;mysql -u root -p pluggedoutmysql&amp;gt; DELETE FROM blog2_entries;mysql&amp;gt; OPTIMIZE TABLE blog2_entries;mysql&amp;gt; WARNINGS;mysql&amp;gt; LOAD DATA INFILE '/home/jeltsch/export.csv' INTO TABLE blog2_entries FIELDS TERMINATED BY ',';&lt;/code&gt;The WARNINGS command shows you when there are problems. Mostly they were related to the field delimiter (comma). I had to escape all commas, that were not field delimiters (,). I also needed to fix the date format (swap month and day). Since the categories were maintained in a separate table, I recreated a csv file by hand and set all entries to belong to the category &amp;ldquo;computer&amp;rdquo;. This .csv file was pretty simple:&lt;code&gt;1,1,22,2,23,3,24,4,2&lt;/code&gt; etc.&lt;code&gt;mysql&amp;gt; DELETE FROM blog2_entry_categories;mysql&amp;gt; OPTIMIZE TABLE blog2_entry_categories;mysql&amp;gt; LOAD DATA INFILE '/home/jeltsch/cat.csv' INTO TABLE blog2_entry_categories FIELDS TERMINATED BY ',';&lt;/code&gt;&lt;/p&gt;</description></item><item><title>How to backup mysql databases (mysqlhotcopy, mysqldump)</title><link>https://jeltsch.org/en/how_to_backup_mysql_databases_mysqlhotcopy_mysqldump/</link><pubDate>Sat, 16 Dec 2006 00:00:00 +0000</pubDate><guid>https://jeltsch.org/en/how_to_backup_mysql_databases_mysqlhotcopy_mysqldump/</guid><description>&lt;p&gt;There are different possibilities. If you have access to the machine where mysql is running, you should use:&lt;code&gt;mysqlhotcopy&lt;/code&gt; On our RedHat 8 server you just type:&lt;code&gt;/usr/bin/mysqlhotcopy --user=root --password=sdjksjd journal /path/to/backup/directory&lt;/code&gt; Alternatively:&lt;code&gt;/usr/local/mysql/bin/mysqldump --user=username -p phpgedview &amp;gt;phpgedview&lt;/code&gt; The path of the command is specific for the mysql install on a MacOS X machine.If you want to back up from another machine you can use the mysqldump command: &lt;code&gt;mysqldump --host=hostname_or_ipaddress --user=username -p phpgedview &amp;gt;phpgedview&lt;/code&gt; This example backs up the database phpgedview which is on the machine hostname_or_ipaddress.The actual database files are in subdirectories in /var/lib/mysql in case you don&amp;rsquo;t remember their names.To automatically backup a database via the network you can put a file with the following content to the /etc/cron.hourly directory:&lt;code&gt;!/bin/sh mysqldump --host=hostname_or_ipaddress --user=USER -pPASSWORD journal &amp;gt;mysqldump_journal&lt;/code&gt; This would create every hour a fresh backupfile called mysqldump_journal in the /etc/cron.hourly directory.&lt;/p&gt;</description></item><item><title>Adding a new user to MySQL and other basic mysql commands</title><link>https://jeltsch.org/en/adding_a_new_user_to_mysql_and_other_basic_mysql_commands/</link><pubDate>Mon, 18 Sep 2006 00:00:00 +0000</pubDate><guid>https://jeltsch.org/en/adding_a_new_user_to_mysql_and_other_basic_mysql_commands/</guid><description>&lt;p&gt;Crontab entry to backup all mysql databases to a file every midnight:&lt;code&gt;0 0 * * * mysqldump -u mjeltsch -h localhost --all-databases | gzip -9 &amp;gt; /home/mjeltsch/Documents/mysqldump.gz &amp;gt; /dev/null&lt;/code&gt;Granting privileges to users connecting from localhost:&lt;code&gt;GRANT ALL PRIVILEGES ON *.* TO 'michael'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;&lt;/code&gt;Granting privileges to users connecting from everywhere:&lt;code&gt;GRANT ALL PRIVILEGES ON *.* TO 'michael'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;&lt;/code&gt;Show all available databases:&lt;code&gt;SHOW DATABASES;&lt;/code&gt;Show all entries of the table &amp;ldquo;users&amp;rdquo;:SELECT * FROM users;Load database &amp;ldquo;phpgedview&amp;rdquo;:USE phpgedview;Create a new database named &amp;ldquo;phpgedview&amp;rdquo;:CREATE DATABASE phpgedview;Delete the database named &amp;ldquo;phpgedview&amp;rdquo;:DROP DATABASE phpgedview;Start mysql client as user michael and user database &amp;ldquo;phpgedview&amp;rdquo;:mysql &amp;ndash;user=michael -p phpgedviewDelete the user &amp;ldquo;test&amp;rdquo;:mysql&amp;gt; use mysql;mysql&amp;gt; delete from user where user=&amp;lsquo;test&amp;rsquo;;mysql&amp;gt; FLUSH PRIVILEGES;Changing the password for the user phpgedview being user root (this works also for changing the password for root):/usr/bin/mysql -u root -pSET PASSWORD FOR phpgedview@&amp;ldquo;localhost&amp;rdquo; = PASSWORD(&amp;lsquo;NewPassWord&amp;rsquo;);After installing the Suse rpm for mysql, execute the following commands:&lt;code&gt;sudo /usr/bin/mysql_install_db&lt;/code&gt;This creates the default databases &amp;amp; permissions. Apparently the same can be done by:&lt;code&gt;sudo rcmysql start&lt;/code&gt;Using SuSE you should use the Yast runlevel editor to start the mysql server automatically at boot time. To start the mysql server manually:&lt;code&gt;sudo /usr/bin/mysqld_safe --user=mysql &amp;amp;&lt;/code&gt;REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! This is done with:&lt;code&gt;/usr/bin/mysqladmin -u root password 'new-password'&lt;/code&gt;If you access the mysql server from another machine you need to specify the hostname:&lt;code&gt;/usr/bin/mysqladmin -u root -h hostname password 'new-password'&lt;/code&gt;Give all privileges to root and user:&lt;code&gt;mcblpc2:/home/user /usr/bin/mysql -u root -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 to server version: 4.0.15 Type 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql&amp;gt; GRANT ALL PRIVILEGES ON *.* TO user@localhost IDENTIFIED BY 'Password' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec)mysql&amp;gt; GRANT ALL PRIVILEGES ON *.* TO user@'%' IDENTIFIED BY 'Password' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec)mysql&amp;gt; GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY 'Password' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec)mysql&amp;gt; GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY 'Password' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec)mysql&amp;gt; quit Bye&lt;/code&gt;Check the mysql version:&lt;code&gt;/usr/bin/mysqladmin -u root -p version&amp;quot; is necessary&lt;/code&gt;Check the mysql variables:&lt;code&gt;/usr/bin/mysqladmin -u root -p variables&lt;/code&gt;Shut down the mysql server:&lt;code&gt;/usr/bin/mysqladmin -u root -p shutdown&lt;/code&gt;Check whether the server can be started:&lt;code&gt;sudo /usr/bin/mysqld_safe --log &amp;amp;&lt;/code&gt;Show all databases:&lt;code&gt;/usr/bin/mysqlshow -u root -p&lt;/code&gt;Show the tables of database &amp;ldquo;mysql&amp;rdquo;:&lt;code&gt;/usr/bin mysqlshow -u root -p mysql&lt;/code&gt;Show the columns of the table named &amp;rsquo;tablename&amp;rsquo;:&lt;code&gt;show columns from tablename;&lt;/code&gt;Remove whitespaces from the column named &amp;lsquo;columnname&amp;rsquo; in the table named &amp;rsquo;tablename&amp;rsquo;:&lt;code&gt;update &lt;/code&gt;tablename&lt;code&gt;set&lt;/code&gt;columnname&lt;code&gt;= trim(' ' from&lt;/code&gt;columnname&lt;code&gt;);&lt;/code&gt;Remove trailing line breaks from the column named &amp;lsquo;columnname&amp;rsquo; in the table named &amp;rsquo;tablename&amp;rsquo; (you might need to execute this repeatedly for some strange reason to remove all carriage returns and line feeds):&lt;code&gt;update &lt;/code&gt;tablename&lt;code&gt;set&lt;/code&gt;columnname&lt;code&gt;= trim(trailing '\n' from&lt;/code&gt;columnname&lt;code&gt;);update &lt;/code&gt;tablename&lt;code&gt;set&lt;/code&gt;columnname&lt;code&gt;= trim(trailing '\r' from&lt;/code&gt;columnname&lt;code&gt;);&lt;/code&gt;&lt;/p&gt;</description></item></channel></rss>