Main Menu

search

You are here

mySQL

[last updated: 2021-05-11]
mySQL Installation:
mySQL Operation:
install on Dell tower, Linux dual-boot:
reset password:
Clients & Webservers
PHP
DataBases:
-----

This page is rough and still in development.
It's a combination of things I've read and things I've tried.
Some worked, some didn't.

----------------------------------------------------------------------------------------------------------


I installed Ver 8.42 Distrib 5.7.25 on my Dell Precision M4400 laptop (2019-02-24)
The installation process went amazingly well, given my relative ignorance.
I installed Ver 14.14 Distrib 5.7.28 on my Dell tower (2019-11-05)
Mysql is required for me to set up a local Drupal server. In addition, however: DataBases needed/wanted
Related Programs:
PHP version...
phpMyAdmin
Apache2
-----

  • Contents on this page:
    • Starting and Stopping the MySQL Server:
    • Logging on and off:
    • Misc Command Info:
    • Config Files:
    • Database location:
    • Reference links:

    ---------------------------

  • Starting & Stopping:
    Online searching found lots of options to do this, with mostly no explanation of why you'd use one command over another.
    • See if it's running:
      $ ps -ef | grep mysqld
      In my installation, it gets started on bootup/restart
    • Start it:
      $ sudo service mysql start
      OR: $ sudo systemctl start mysql
      (Commands that did not work: service mysqld start...)
    • Stop it:
      $ sudo service mysql stop
      OR: $ sudo systemctl stop mysql
      OR: $ sudo /etc/init.d/mysql stop
      OR: $ sudo /usr/bin/mysqladmin -u root shutdown ... (this failed for access denied on root@localhost with no password)

    -------------------------

  • Logon and off of MySQL:
    • Log on:
      Is this the same as "connecting to the mysql server" ?
      This topic remains confusing to me. So far I have successfully logged on with several methods.

      • Log on (as root) from CLI: to interact with mysql directly, ie without phpmyadmin:
        $ sudo mysql -u root ... the '-u root' specifies to log in as user=root
          if successful, prompt will be:
          mysql>


        OR: $ sudo mysql -u root -p ... in addition to requiring sudo password, also asks "Enter password:" for mysql password, which at this time seems to be irrelevant,
        since any (or no) text that is typed, followed by [CR] will be successful.

        also suggested: $ sudo mysql -u root mysql ... This worked too.

        However this worked too:
        $ sudo mysql ... this logs you in, as do all the others, as user 'root'

        • You must change your root password (which on my system by default seems to be <CR>)
        • mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
        • Until you change your root password, you will not be able to exercise any of the superuser privileges, even if you are logged in as root.
        • HOWEVER: Even after doing this, login wlll accept anything typed that is followed with CR.

        ---------------------------

      • Log in via phpmyadmin:
        phpmyadmin is a web application client,
        that is accessed by opening a web browser with URL: localhost/phpmyadmin.


        I could find no password that worked if trying to log in as username: root
        However by viewing /etc/dbconfig-common/phpmyadmin.conf as described here , I can see the password it expects for username: phpmyadmin
        That was successful.

      • Log into a specific database:
        $ sudo mysql -u [userName] -p [databaseName]
    • Log off:
      mysql> exit ... or quit
      OR: mysql> [ctrl]-d

    --------------------

  • Misc Command Info:
    • Commands entered after the "mysql>" prompt must be terminated with a " ; "
      (supposedly there are exceptions to this, but I don't know of any except the "exit" command)
    • If you execute a command that results in a 'warning,' you can view the warning with:
      mysql> show warnings;
      But you must execute this immediately, as the buffer isn't saved past the next command (??)
    • Commands are not case-sensitive
      However database, table and column names ARE case sensitive.

    --------------------

  • Config Files:
    • on my tower:
      /etc/mysql/my.cnf
      /etc/mysql/mysql.cnf
      /etc/mysql/conf.d/mysql.cnf
      /etc/mysql/mysql.conf.d/mysqld.cnf
    • However I saw nothing in any of them that was helpful...
    • If changes are made to the config files, mysql must be stopped and restarted for the changes to take effect.

    ----------------------

  • Database Location:
    • Databases are located in:
      /var/lib/mysql
    • Among others, there are now folders/databases for:
      drupal
      mysql
      phpmyadmin

    ---------------------------

  • Reference Links:

.

.

.

eof