- GUI
- Windows API tutorial
- Introduction to Windows API
- Windows API main functions
- System functions in Windows API
- Strings in Windows API
- Date & time in Windows API
- A window in Windows API
- First steps in UI
- Windows API menus
- Windows API dialogs
- Windows API controls I
- Windows API controls II
- Windows API controls III
- Advanced controls in Windows API
- Custom controls in Windows API
- The GDI in Windows API
- PyQt4 tutorial
- PyQt5 tutorial
- Qt4 tutorial
- Introduction to Qt4 toolkit
- Qt4 utility classes
- Strings in Qt4
- Date and time in Qt4
- Working with files and directories in Qt4
- First programs in Qt4
- Menus and toolbars in Qt4
- Layout management in Qt4
- Events and signals in Qt4
- Qt4 Widgets
- Qt4 Widgets II
- Painting in Qt4
- Custom widget in Qt4
- The Breakout game in Qt4
- Qt5 tutorial
- Introduction to Qt5 toolkit
- Strings in Qt5
- Date and time in Qt5
- Containers in Qt5
- Working with files and directories in Qt5
- First programs in Qt5
- Menus and toolbars in Qt5
- Layout management in Qt5
- Events and signals in Qt5
- Qt5 Widgets
- Qt5 Widgets II
- Painting in Qt5
- Custom widget in Qt5
- Snake in Qt5
- The Breakout game in Qt5
- PySide tutorial
- Tkinter tutorial
- Tcl/Tk tutorial
- Qt Quick tutorial
- Java Swing tutorial
- JavaFX tutorial
- Java SWT tutorial
- wxWidgets tutorial
- Introduction to wxWidgets
- wxWidgets helper classes
- First programs in wxWidgets
- Menus and toolbars in wxWidgets
- Layout management in wxWidgets
- Events in wxWidgets
- Dialogs in wxWidgets
- wxWidgets widgets
- wxWidgets widgets II
- Drag and Drop in wxWidgets
- Device Contexts in wxWidgets
- Custom widgets in wxWidgets
- The Tetris game in wxWidgets
- wxPython tutorial
- Introduction to wxPython
- First Steps
- Menus and toolbars
- Layout management in wxPython
- Events in wxPython
- wxPython dialogs
- Widgets
- Advanced widgets in wxPython
- Drag and drop in wxPython
- Internationalisation
- Application skeletons in wxPython
- The GDI
- Mapping modes
- Creating custom widgets
- Tips and Tricks
- wxPython Gripts
- The Tetris game in wxPython
- C# Winforms Mono tutorial
- Java Gnome tutorial
- Introduction to Java Gnome
- First steps in Java Gnome
- Layout management in Java Gnome
- Layout management II in Java Gnome
- Menus in Java Gnome
- Toolbars in Java Gnome
- Events in Java Gnome
- Widgets in Java Gnome
- Widgets II in Java Gnome
- Advanced widgets in Java Gnome
- Dialogs in Java Gnome
- Pango in Java Gnome
- Drawing with Cairo in Java Gnome
- Drawing with Cairo II
- Nibbles in Java Gnome
- QtJambi tutorial
- GTK+ tutorial
- Ruby GTK tutorial
- GTK# tutorial
- Visual Basic GTK# tutorial
- PyGTK tutorial
- Introduction to PyGTK
- First steps in PyGTK
- Layout management in PyGTK
- Menus in PyGTK
- Toolbars in PyGTK
- Signals & events in PyGTK
- Widgets in PyGTK
- Widgets II in PyGTK
- Advanced widgets in PyGTK
- Dialogs in PyGTK
- Pango
- Pango II
- Drawing with Cairo in PyGTK
- Drawing with Cairo II
- Snake game in PyGTK
- Custom widget in PyGTK
- PHP GTK tutorial
- C# Qyoto tutorial
- Ruby Qt tutorial
- Visual Basic Qyoto tutorial
- Mono IronPython Winforms tutorial
- Introduction
- First steps in IronPython Mono Winforms
- Layout management
- Menus and toolbars
- Basic Controls in Mono Winforms
- Basic Controls II in Mono Winforms
- Advanced Controls in Mono Winforms
- Dialogs
- Drag & drop in Mono Winforms
- Painting
- Painting II in IronPython Mono Winforms
- Snake in IronPython Mono Winforms
- The Tetris game in IronPython Mono Winforms
- FreeBASIC GTK tutorial
- Jython Swing tutorial
- JRuby Swing tutorial
- Visual Basic Winforms tutorial
- JavaScript GTK tutorial
- Ruby HTTPClient tutorial
- Ruby Faraday tutorial
- Ruby Net::HTTP tutorial
- Java 2D games tutorial
- Java 2D tutorial
- Cairo graphics tutorial
- PyCairo tutorial
- HTML5 canvas tutorial
- Python tutorial
- Python language
- Interactive Python
- Python lexical structure
- Python data types
- Strings in Python
- Python lists
- Python dictionaries
- Python operators
- Keywords in Python
- Functions in Python
- Files in Python
- Object-oriented programming in Python
- Modules
- Packages in Python
- Exceptions in Python
- Iterators and Generators
- Introspection in Python
- Ruby tutorial
- PHP tutorial
- Visual Basic tutorial
- Visual Basic
- Visual Basic lexical structure
- Basics
- Visual Basic data types
- Strings in Visual Basic
- Operators
- Flow control
- Visual Basic arrays
- Procedures & functions in Visual Basic
- Organizing code in Visual Basic
- Object-oriented programming
- Object-oriented programming II in Visual Basic
- Collections in Visual Basic
- Input & output
- Tcl tutorial
- C# tutorial
- Java tutorial
- AWK tutorial
- Jetty tutorial
- Tomcat Derby tutorial
- Jtwig tutorial
- Android tutorial
- Introduction to Android development
- First Android application
- Android Button widgets
- Android Intents
- Layout management in Android
- Android Spinner widget
- SeekBar widget
- Android ProgressBar widget
- Android ListView widget
- Android Pickers
- Android menus
- Dialogs
- Drawing in Android
- Java EE 5 tutorials
- Introduction
- Installing Java
- Installing NetBeans 6
- Java Application Servers
- Resin CGIServlet
- JavaServer Pages, (JSPs)
- Implicit objects in JSPs
- Shopping cart
- JSP & MySQL Database
- Java Servlets
- Sending email in a Servlet
- Creating a captcha in a Servlet
- DataSource & DriverManager
- Java Beans
- Custom JSP tags
- Object relational mapping with iBATIS
- Jsoup tutorial
- MySQL tutorial
- MySQL quick tutorial
- MySQL storage engines
- MySQL data types
- Creating, altering and dropping tables in MySQL
- MySQL expressions
- Inserting, updating, and deleting data in MySQL
- The SELECT statement in MySQL
- MySQL subqueries
- MySQL constraints
- Exporting and importing data in MySQL
- Joining tables in MySQL
- MySQL functions
- Views in MySQL
- Transactions in MySQL
- MySQL stored routines
- MySQL Python tutorial
- MySQL Perl tutorial
- MySQL C API programming tutorial
- MySQL Visual Basic tutorial
- MySQL PHP tutorial
- MySQL Java tutorial
- MySQL Ruby tutorial
- MySQL C# tutorial
- SQLite tutorial
- SQLite C tutorial
- SQLite PHP tutorial
- SQLite Python tutorial
- SQLite Perl tutorial
- SQLite Ruby tutorial
- SQLite C# tutorial
- SQLite Visual Basic tutorial
- PostgreSQL C tutorial
- PostgreSQL Python tutorial
- PostgreSQL Ruby tutorial
- PostgreSQL PHP tutorial
- PostgreSQL Java tutorial
- Apache Derby tutorial
- SQLAlchemy tutorial
- MongoDB PHP tutorial
- MongoDB Java tutorial
- MongoDB JavaScript tutorial
- MongoDB Ruby tutorial
- Spring JdbcTemplate tutorial
- JDBI tutorial
MySQL installation
In this part of the MySQL tutorial, we are going to cover the installation of the MySQL database management system. In this chapter, we will install MySQL on Linux.
There are several ways how we can install MySQL on our system. We can install MySQL from packages, from binaries or from the sources.
$ sudo apt-get install mysql-server
On Ubuntu and other Debian based distributions, we can easily install MySQL from packages by using the apt-get
tool. This command installs the MySQL server and various other packages. While installing the packages, we are prompted to enter a password for the MySQL root account.
Installing from sources
Installing MySQL from sources gives us the most options to build MySQL according to our preferences. We can customise installation locations, various build parameters or compiler optimisations.
We enter the mysql.com website. Under Downloads tab, we select generally available MySQL Community Edition. From the Select platform combo box, we choose Source Code.
$ ls -sh mysql-5.5.9.tar.gz 23M mysql-5.5.9.tar.gz
We have downloaded a compressed archive of MySQL 5.5.9 sources.
$ tar xzvf mysql-5.5.9.tar.gz $ cd mysql-5.5.9/
We have unpacked the sources to the mysql-5.5.9
directory.
$ sudo apt-get install cmake $ which cmake bison perl /usr/bin/cmake /usr/bin/bison /usr/bin/perl
To build MySQL, we need to have three tools installed on our system: cmake, bison, and Perl. In our case, we had to install the cmake
tool. The cmake
tool has replaced the configure tool, because it is more portable.
$ cmake -L -- MySQL 5.5.9 -- Configuring done -- Generating done -- Build files have been written to: /home/vronskij/Downloads/mysql-5.5.9 -- Cache values CMAKE_BUILD_TYPE:STRING=RelWithDebInfo CMAKE_INSTALL_PREFIX:PATH=/usr/local/mysql COMMUNITY_BUILD:BOOL=ON ENABLED_PROFILING:BOOL=ON ENABLE_DEBUG_SYNC:BOOL=ON INSTALL_LAYOUT:STRING=STANDALONE MYSQL_DATADIR:PATH=/usr/local/mysql/data MYSQL_MAINTAINER_MODE:BOOL=OFF WITH_ARCHIVE_STORAGE_ENGINE:BOOL=OFF WITH_BLACKHOLE_STORAGE_ENGINE:BOOL=OFF WITH_DEBUG:BOOL=OFF WITH_EMBEDDED_SERVER:BOOL=OFF WITH_EXTRA_CHARSETS:STRING=all WITH_FEDERATED_STORAGE_ENGINE:BOOL=OFF WITH_INNOBASE_STORAGE_ENGINE:BOOL=ON WITH_LIBEDIT:BOOL=ON WITH_LIBWRAP:BOOL=OFF WITH_PARTITION_STORAGE_ENGINE:BOOL=ON WITH_PERFSCHEMA_STORAGE_ENGINE:BOOL=ON WITH_PIC:BOOL=OFF WITH_READLINE:BOOL=OFF WITH_SSL:STRING=no WITH_UNIT_TESTS:BOOL=ON WITH_VALGRIND:BOOL=OFF WITH_ZLIB:STRING=system
The -L
option shows some of the default configure options. The system is going to be installed to /usr/loca/mysql directory
. For us it is important to have InnoDB storage engine configured to be included.
$ cmake .
We configure the build. We leave all the default settings. In case we wanted to have also the MySQL embedded system, we would provide the -DWITH_EMBEDDED_SERVER=1
option.
$ make $ sudo make install
We make the system and install it.
$ sudo addgroup --system mysql $ sudo adduser --system mysql --no-create-home -ingroup mysql
We create a mysql system group and a mysql system user on our computer. Each process in Linux is owned by a specific user. The MySQL daemon will be owned by user mysql. Note that mysql is not a normal user account. It is a system user.
$ pwd /usr/local/mysql $ sudo chown -R mysql . $ sudo chgrp -R mysql .
We are located in the /usr/local/mysql
directory. We change the group and owner of all files located in the mentioned directory. The -R
option means recursive operation. This means that the two commands operate on all files and directories and the contents of the directories.
$ sudo ./scripts/mysql_install_db --user=mysql
Here we install MySQL system tables. These tables are necessary for MySQL to be functional.
$ sudo chown -R root . $ sudo chown -R mysql data
We change the owner for all files back to the user root, except for the data directory. The MySQL server, which is owned by the mysql user, must have access to the data directory. The database files are stored in this directory.
Changing the root password
By default, the MySQL superuser root has an empty password. We need to set a password for the root account.
$ su Password: # /usr/local/mysql/bin/mysqld_safe & # exit exit $
We start the MySQL server. We change to the Linux root account and launch the mysqld_safe script
. It is a MySQL server startup script.
$ sudo passwd root Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully $ su root Password: root@spartan:/usr/local/mysql#
On Ubuntu, the (Linux) root account is not enabled by default. Here we show, how to enable it. Then we can use the su (switch user) command to switch to root to start the MySQL daemon.
$ bin/mysqladmin -u root password '345jas7'
Using the mysqladmin we change the password for the root account. Note that command is launched without the sudo.
Other settings
After we have installed the MySQL on our system and changed a password for the root account, there are still some modifications left to do.
MySQL has a configuration file called my.cnf
. This is located in the /etc
directory. By editing the options in this file, we can configure the server to our needs.
$ cp support-files/my-medium.cnf /etc/my.cnf $ cp support-files/my-medium.cnf ~/.my.cnf
In the support-files directory there are prepared configuration files. We can choose one of them, which best suits us. In the first command, we create MySQL global configuration file. In the second example, we create a personal file in the home directory of the user. This part is optional.
$ export PATH=$PATH:/usr/local/mysql/bin/ $ export MANPATH=$MANPATH:/usr/local/mysql/man/
Another useful thing to do is to add bin direcory to your PATH
variable. This way we can launch MySQL commands and scripts without specifying the full path. In addition, we add the path to the manual pages of the MySQL tools and commands to the MANPATH
variable. Now we can view MySQL man pages with the man command. Place both commands to your shell configuration file. In case of the bash it is .bashrc
.
In this part of the MySQL tutorial, we have covered the installation of the MySQL database system.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论