MySQL Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
 
(17 intermediate revisions by the same user not shown)
Line 5: Line 5:
* [[MySQL]]
* [[MySQL]]


=Logs=
=Version=
Connect to the database then execute:
<syntaxhighlight lang='sql'>
SELECT VERSION();
</syntaxhighlight>
=Layout=
==Linux==
===Logs===
<code>/var/log/mariadb/</code><br>
<code>/var/log/mysql/</code>


<tt>/var/log/mariadb/</tt>
===Data Directory===


<tt>/var/log/mysql/</tt>
<code>/var/lib/mysql</code>


=Data Directory=
===Runtime Directory===


<tt>/var/lib/mysql</tt>
<code>/var/run/mariadb</code>
 
===Configuration File===
{{External|https://mariadb.com/kb/en/configuring-mariadb-with-option-files/#default-option-file-locations-on-linux-unix-mac}}
Default location: <code>/etc/my.cnf</code>
 
==Mac==
<font size=-2>
  /opt
  └── brew
        ├── Cellar
        │    └── mariadb
        │          └── 11.2.2
        │              └── ...
        ├── etc
        │    ├── my.cnf
        │    └── my.cnf.d
        │        └──  ...
        ├── opt
        │    └── mariadb
        │        └──  bin
        │              └──  mysqld_safe
        └── var
            └── mysql <font color=teal># Data directory</font>
                  └──  ...
</font>


=Change Root Password=
=Change Root Password=


<pre>
<syntaxhighlight lang='bash'>
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h now510.local password 'new-password'
/usr/bin/mysqladmin -u root -h now510.local password 'new-password'
</pre>
</syntaxhighlight>
 
Useful: https://www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-password


=Command Line Client=
=Command Line Client=


[[mysql Command Line Client]]
{{Internal|mysql Command Line Client|mysql Command Line Client}}
 
=Subjects=
* [[MySQL DDL Operations]]

Latest revision as of 04:31, 25 December 2023

Internal

Version

Connect to the database then execute:

SELECT VERSION();

Layout

Linux

Logs

/var/log/mariadb/
/var/log/mysql/

Data Directory

/var/lib/mysql

Runtime Directory

/var/run/mariadb

Configuration File

https://mariadb.com/kb/en/configuring-mariadb-with-option-files/#default-option-file-locations-on-linux-unix-mac

Default location: /etc/my.cnf

Mac

 /opt
  └── brew
       ├── Cellar
       │     └── mariadb
       │          └── 11.2.2
       │               └── ...
       ├── etc
       │    ├── my.cnf
       │    └── my.cnf.d
       │         └──  ...
       ├── opt
       │    └── mariadb
       │        └──  bin
       │              └──  mysqld_safe
       └── var
            └── mysql  # Data directory
                 └──  ...

Change Root Password

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h now510.local password 'new-password'

Useful: https://www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-password

Command Line Client

mysql Command Line Client

Subjects