mysql初始化后尝试启动mysql(成功!)
继上次进行初始化后,然后尝试启动mysql程序,当时也不知道哪个文件是可以启动mysql的文件,然后继续百度。
发现 /usr/local/mysql/share/mysql 下面找到了传说中的 mysql.server 文件.
然后尝试运行此文件:
root@b-ThinkPad-X230s:/usr/local/mysql/share/mysql# ./mysql.server start
Starting MySQL
. * Manager of pid-file quit without updating file. (这里出现问题了,然后网上百度了半天,发现大家的解决方法并不适合我的,也许解决问题的本质是一样的吧,我目前还不清楚)
然后就一直卡在这里了。目前也不知道哪里可以看到 mysql的错误日志,下来慢慢找 。
索性直接查看 mysql.server这个脚本文件,发现:
basedir= (空的?)
datadir=
因为我也不知道具体机制是如何的,感觉不应该这样,索性填写目录进去:
basedir=/usr/local/mysql/
datadir=/usr/local/mysql/data/
保存,退出。
再次尝试运行:
root@b-ThinkPad-X230s:/usr/local/mysql/share/mysql# ./mysql.server start
Starting MySQL
. *
看起来成功了!
然后验证一下是否已经在运行了:
root@b-ThinkPad-X230s:/usr/local/mysql/share/mysql# ps -aux | grep "my"
root 6128 0.0 0.0 4476 1732 pts/4 S 15:14 0:00 /bin/sh /usr/local/mysql//bin/mysqld_safe --datadir=/usr/local/mysql/data/ --pid-file=/usr/local/mysql/data//b-ThinkPad-X230s.pid
mysql 6197 0.0 0.1 118412 9580 pts/4 Sl 15:14 0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/ --user=mysql --log-error=/usr/local/mysql/data//b-ThinkPad-X230s.err --pid-file=/usr/local/mysql/data//b-ThinkPad-X230s.pid
root 6207 0.0 0.0 13708 2184 pts/4 S+ 15:16 0:00 grep --color=auto my
有进程了!
然后尝试进入mysql (至此,我还是一头雾水,目前还有帐号的问题和实例的问题比较模糊,因为进程中出现的是/usr/local/mysql//bin/mysqld_safe,目前还不了解这个是什么意思!)
root@b-ThinkPad-X230s:/usr/local/mysql/bin# sudo ./mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.70 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
然后找了懂的大神操作了如下内容证明没有问题,我还不明白具体是什么意思,下来继续学习:
mysql> show tables;
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| columns_priv |
| db |
| event |
| func |
| general_log |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| servers |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
23 rows in set (0.00 sec)
mysql> select * from db;
+------+---------+------+-------------+-------------+-------------+-------------+-------------+-----------+------------+-----------------+------------+------------+-----------------------+------------------+------------------+----------------+---------------------+--------------------+--------------+------------+--------------+
| Host | Db | User | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Create_tmp_table_priv | Lock_tables_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Execute_priv | Event_priv | Trigger_priv |
+------+---------+------+-------------+-------------+-------------+-------------+-------------+-----------+------------+-----------------+------------+------------+-----------------------+------------------+------------------+----------------+---------------------+--------------------+--------------+------------+--------------+
| % | test | | Y | Y | Y | Y | Y | Y | N | Y | Y | Y | Y | Y | Y | Y | Y | N | N | Y | Y |
| % | test\_% | | Y | Y | Y | Y | Y | Y | N | Y | Y | Y | Y | Y | Y | Y | Y | N | N | Y | Y |
+------+---------+------+-------------+-------------+-------------+-------------+-------------+-----------+------------+-----------------+------------+------------+-----------------------+------------------+------------------+----------------+---------------------+--------------------+--------------+------------+--------------+
2 rows in set (0.00 sec)
mysql> exit