MySQL notes

 
yum install mysql
yum install mysql-server
/etc/init.d/mysqld start

STEPS
  • create a MySQL "root" user
  • create a regular MySQL user for the application to use
  • create the database
  • create the tables

to config MySQL to start at boot: (as root)
chkconfig mysqld on

To see if MySQL is running
pgrep mysqld

To start, stop, restart MySQL:
/sbin/service mysqld start
/sbin/service mysqld stop
/sbin/service mysqld restart

DONT Kill! It may not complete transactions properly.

(pkill mysqld)

CONFIG FILE has where the database lives on filesystem, where logs go, etc.
/etc/my.cnf
[root@x41 chogue]# more /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

# To allow mysqld to connect to a MySQL Cluster management daemon, uncomment
# these lines and adjust the connectstring as needed.
#ndbcluster
#ndb-connectstring="nodeid=4;host=localhost:1186"

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[ndbd]
# If you are running a MySQL Cluster storage daemon (ndbd) on this machine,
# adjust its connection to the management daemon here.
# Note: ndbd init script requires this to include nodeid!
connect-string="nodeid=2;host=localhost:1186"

[ndb_mgm]
# connection string for MySQL Cluster management tool
connect-string="host=localhost:1186"


CREATE a MySQL "root" Account
(make sure MySQL is started)

/usr/bin/mysqladmin -u root password 'new-password'


FIRST TIME MySQL CLI Access:
[root@x41 chogue]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.39 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> quit
Bye

PHPMyAdmin

You need to turn of SELimux with setenforce 0
to see it working on Centos.  Once it is working you can reset it with setenforce 1 and reset the SELinux security context settings for the php and other files in the web server directory.

 

 
 


Some MYSQL packages (Fedora Core 12 Distro) relevant to C++/Java
NOTE some of these may not be YUM accessible on CentOS
mysql-connector-java.i686 : Official JDBC driver for MySQL
innotop.noarch : A MySQL and InnoDB monitor program
mysql++.i686 : C++ wrapper for the MySQL C API
mysql++-devel.i686 : MySQL++ developer files (headers, examples, etc.)
mysql++-manuals.i686 : MySQL++ user and reference manuals
mysql.i686 : MySQL client programs and shared libraries
mysql-administrator.i686 : GUI tools to manage mysql Databases
mysql-bench.i686 : MySQL benchmark scripts and data
mysql-connector-odbc.i686 : ODBC driver for MySQL
mysql-devel.i686 : Files for development of MySQL applications
mysql-gui-common.i686 : Common data shared among the MySQL GUI Suites
mysql-gui-tools.i686 : GUI tools to manage mysql Databases
mysql-libs.i686 : The shared libraries required for MySQL clients
mysql-query-browser.i686 : A graphical tool for handling MySQL queries
mysql-server.i686 : The MySQL server and related files
mysql-test.i686 : The test suite distributed with MySQL
mysqlreport.noarch : A friendly report of important MySQL status values
mysqltuner.noarch : MySQL high performance tuning script
php-mysql.i686 : A module for PHP applications that use MySQL databases
phpMyAdmin.noarch : Web based MySQL browser written in php
unixODBC.i686 : A complete ODBC driver manager for Linux

Comments